Skip to content Skip to sidebar Skip to footer

Listening For Event In Dart Via JQuery "on"

I am using a Bootstrap Modal dialog in Dart via js interop. All works OK apart from listening for the custom events. I am trying to listen to the 'shown' event using the following

Solution 1:

You get this error because the callback should have one parameter (handler parameter of on documentation take a eventObject parameter). So your code should be :

js.context.jQuery("#myModal").on("shown", new js.Callback.many((eventObject) {
  print("Dialog Shown");
}));

Note also the use of js.Callback.many instead of js.Callback.once. The former allows the callback to be called several times.


Post a Comment for "Listening For Event In Dart Via JQuery "on""