现在我正在开发基于html5和phoneGap的移动应用程序.JE famework是ember。应用程序的规范需要响应长按手势。但长篇大论的事件不是内置事件。
如何识别手势并连接到事件处理(控制器或路线)?
答案 0 :(得分:0)
我可以使用mouseUp
和mouseDown
完成此操作,但您可以使用我确定的touchStart
和touchEnd
个事件。见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'));
}
})