Depending on the widget raise an issue on Github or if the widget has platform support raise a support ticket with Mendix.
Regards,
Ronald
The solution is documented here: https://apidocs.mendix.com/7/client/module-mendix_lang.html
Deprecated: since version 7.0, just use if (callback) callback(); expression instead