I’m writing a Dart class to wrap the jqueryUI slider. The jquery code looks like:
$("#diameter_slider").slider({'range': true, max: 50, min: 0, values: [0, 50],
slide: function( event, ui ) {
//code executed when the slider is moved goes here
});
My Dart class looks like:
class Slider {
Map options;
String css_id;
String units;
var slider;
Slider( {this.options, this.css_id, this.units} ) {
js.scoped((){
slider = js.context.$(css_id);
final updater = new js.Callback.many((d, i, context) { query("#diameter").text = 'here';});
final opts = js.map({ 'range': true,
'values': [options['min'], options['max']],
'slide': updater});
slider.slider(opts);
js.retain(slider);
});
}
void UpdateText( var event, var ui ){
query("#diameter").text = 'here';
}
}
When executed the slider displays correctly (using Dartium). But When the slider is moved Dartium crashes. What is the correct way to get parameters passed to Dart from javascript?
Looking at the slide doc, the callback function seems to handle 2 parameters. So, your
updatershould be defined like this :