adding support for using anonymous function handlers with externalEvents