Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
Use rAF for async dispatch
Browse files Browse the repository at this point in the history
Fixes #31
  • Loading branch information
dfreedm committed Mar 10, 2014
1 parent f645ec4 commit e5ec43d
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/dispatcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
// must clone events to keep the (possibly shadowed) target correct for
// async dispatching
var e = this.cloneEvent(inEvent);
setTimeout(this.runQueue.bind(this, inHandlerFns, e), 0);
requestAnimationFrame(this.runQueue.bind(this, inHandlerFns, e));
},
// Dispatch the queued events
runQueue: function(inHandlers, inEvent) {
Expand Down Expand Up @@ -193,10 +193,7 @@
}
},
asyncDispatchEvent: function(inEvent, inTarget) {
var fn = function() {
this.dispatchEvent(inEvent, inTarget);
}.bind(this);
setTimeout(fn, 0);
requestAnimationFrame(this.dispatchEvent.bind(this, inEvent, inTarget));
},
preventTap: function(inPointerId) {
var t = this.recognizers.tap;
Expand Down

0 comments on commit e5ec43d

Please sign in to comment.