From ac580637b66e08d5945a8e2635a5375fcb073c6b Mon Sep 17 00:00:00 2001 From: Daniel Freedman Date: Mon, 10 Mar 2014 16:56:46 -0700 Subject: [PATCH] Use bitwise not to handle differentiating rAF and timeout Fixes #13 --- src/instance/utils.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/instance/utils.js b/src/instance/utils.js index b253ad5..f23168f 100644 --- a/src/instance/utils.js +++ b/src/instance/utils.js @@ -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); }