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

Commit

Permalink
Use bitwise not to handle differentiating rAF and timeout
Browse files Browse the repository at this point in the history
Fixes #13
  • Loading branch information
dfreedm committed Mar 17, 2014
1 parent 8be93c3 commit ac58063
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/instance/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@
var handle = timeout ? setTimeout(fn, timeout) :
requestAnimationFrame(fn);
// NOTE: switch on inverting handle to determine which time is used.
return timeout ? handle : 1 / handle;
return timeout ? handle : ~handle;
},
cancelAsync: function(handle) {
if (handle < 1) {
cancelAnimationFrame(Math.round(1 / handle));
if (handle < 0) {
cancelAnimationFrame(~handle);
} else {
clearTimeout(handle);
}
Expand Down

0 comments on commit ac58063

Please sign in to comment.