{"size": 1048, "ext": "js", "max_stars_repo_path": "source/widgets/motor/motor.widget.js", "max_stars_repo_name": "tisan-kit/tisan-web-ide", "max_stars_repo_stars_event_min_datetime": "2015-11-02T14:02:50.000Z", "max_stars_repo_stars_event_max_datetime": "2019-10-19T07:42:08.000Z", "max_issues_repo_path": "source/widgets/motor/motor.widget.js", "max_issues_repo_name": "tisan-kit/tisan-web-ide", "max_issues_repo_issues_event_min_datetime": "2015-11-10T01:59:16.000Z", "max_issues_repo_issues_event_max_datetime": "2017-10-08T04:21:59.000Z", "max_forks_repo_path": "source/widgets/motor/motor.widget.js", "max_forks_repo_name": "tisan-kit/tisan-web-ide", "max_forks_repo_forks_event_min_datetime": "2015-11-03T07:20:29.000Z", "max_forks_repo_forks_event_max_datetime": "2020-02-22T09:02:29.000Z"}
{"max_stars_count": 20, "max_issues_count": 8, "max_forks_count": 17, "avg_line_length": 23.2888888889, "max_line_length": 57, "alphanum_fraction": 0.5248091603}
!function(){
  if (!window.iotboard){
    console.log("iotboard not initialized!");
    return;
  }

  var widgetName='motor';
  window.iotboard.defineWidget(widgetName, {
    status: {
        speed:'-'
    },
    render: function(dataset){
        var dataset=clone(dataset);
        dataset.status=this.status;
        return template('template-'+widgetName,dataset);
    },
    listeners: [
      {
        selector: ".motor-range",
        event: "change",
        behavior: "set"
      },{
        selector: ".btn-refresh",
        event: "click",
        behavior: "get"
      }
    ],
    parseStatus: function(dom){
      return {
        speed: dom.find(".motor-range").val()
      }
    },
    onRendered:function(dom){
        dom.find('.motor-range').on('input',function(){
            dom.find('.motor-speed').text($(this).val());
        });
		dom.find('.btn-reset').on('click',function(){
			dom.find('.motor-range').val(0);
            dom.find('.motor-speed').text(0);
			dom.find('.motor-range').change();
		});
    }
  });
}();
