I don’t think this is possible, but is there a way to validate the arguments a callback accepts. For example someone passes me callback “mycallback”, I want to assert it accepts an argument String.
public function addHandler(handler : Function) : void{
//pseudo code
Assert.functionAcceptsArguments(handler, String);
}
Cheers
No you can’t. If you had some object as argument you could use
describeTypewhich returns information about methods too. ButFunctionis just a function with no information about arguments.To be sure that you get right method signature you could pass typed objects not Functions. For example