Yes. This can be implemented by using a FuncRef
- First create a method that will be called with the "callback" (In different programming languages: Completion/Block/Closure/... etc.)
func completion_method():
pass # To do something
func completion_method_with_params(p1: String, p2: int):
pass # To do something
- Then create a method that will receive our "callback"
func some_method(completion: FuncRef, completion_with_params: FuncRef):
# To do something
completion.call_func()
# To do something
completion.call_funcv(["kurtsev", 0103])
# To do something
- And now create a reference to the "callback" and just pass it to the method
var completion = funcref(self, "completion_method")
var completion_with_params = funcref(self, "completion_method_with_params")
some_method(completion, completion_with_params)