Following the advice given in the answer you linked, you just have to debounce the callback for a mouseup and check if a second click occurs in a given period.
Assuming a view defined in this manner (http://jsfiddle.net/nikoshr/4KSZx/)
var V = Backbone.View.extend({
events: {
'mouseup button': 'onmouseup',
'dblclick button': 'ondblclick'
},
onmouseup: function() {
console.log('mouseup');
},
ondblclick: function() {
console.log('dblclick');
}
});
you could modify it and "cancel" the mouseup event:
var V = Backbone.View.extend({
events: {
'mouseup button': _.debounce(function(e) {
if (this.doucleckicked) {
this.doucleckicked = false;
} else {
this.onmouseup.call(this, e);
}
}, 300),
'dblclick button': function(e) {
this.doucleckicked = true;
this.ondblclick.call(this, e);
}
},
onmouseup: function() {
console.log('mouseup');
},
ondblclick: function() {
console.log('dblclick');
}
});
And a demo http://jsfiddle.net/4KSZx/6/