Listen to javascript events from Dart -
is there way in dart listen events javascript libraries?
for example jqrangeslider http://ghusse.github.io/jqrangeslider/ package emits uservaluechanged event when releases slider.
is easy listen event in dart via js/js.dart package?
would love see examples of listener in dart listens events javascript library.
thanks js package can deal js code. here dart version of following javascript code snippet :
$("#slider").bind("valueschanged", function(e, data){ console.log("will executed"); });
in dart :
js.scoped((){ js.context.jquery("#slider").bind("valueschanged", new js.callback.many((e, data) { print("will executed"); })); });
note use jquery
instead of $
because have issue dart2js otherwise (see issue 2265).
basically, when use callback functions in js, have use js.callback.many
or js.callback.once
wrap callback. see managing callback lifetimes more details.
Comments
Post a Comment