Merge pull request #328 from thulka/master

Some lines that speed up event handling (20 to 18 % time spent) and make code cleaner.
This commit is contained in:
Eric Rowell
2013-03-19 10:35:22 -07:00

View File

@@ -306,15 +306,10 @@
var that = this;
var events = ['mousedown', 'mousemove', 'mouseup', 'mouseout', 'touchstart', 'touchmove', 'touchend'];
for(var n = 0; n < events.length; n++) {
var pubEvent = events[n];
// induce scope
( function() {
var event = pubEvent;
that.content.addEventListener(event, function(evt) {
that['_' + event](evt);
}, false);
}());
for (var n = 0; n < events.length; n++) {
var pubEvent = events[n];
var f = that['_' + pubEvent];
that.content.addEventListener(pubEvent, f.bind(that), false);
}
},
_mouseout: function(evt) {