2

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?

1 Answer 1

1

Looking at the slide doc, the callback function seems to handle 2 parameters. So, your updater should be defined like this :

final updater = new js.Callback.many((event, ui) { query("#diameter").text = 'here';});
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.