如何识别基于ember的应用程序中的长按手势?

时间:2013-12-24 02:44:31

标签: android ember.js long-press

现在我正在开发基于html5和phoneGap的移动应用程序.JE famework是ember。应用程序的规范需要响应长按手势。但长篇大论的事件不是内置事件。

如何识别手势并连接到事件处理(控制器或路线)?

1 个答案:

答案 0 :(得分:0)

我可以使用mouseUpmouseDown完成此操作,但您可以使用我确定的touchStarttouchEnd个事件。见here

我设置了jsbin,但这是相关的代码:

var myfunction = function() { 
  alert('held');
}

App.ApplicationView = Ember.View.extend({
  mouseDown: function(e){
   var runLater = Ember.run.later(this, myfunction, 1000);
    this.set('pressed', runLater);
  },

  mouseUp: function (e) { 
    Ember.run.cancel(this.get('pressed'));
  }
})