Comparing version 0.3.0 to 0.3.1
@@ -1,1 +0,1 @@ | ||
var version = "0.3.0"; export * from "../index"; export {version}; | ||
var version = "0.3.1"; export * from "../index"; export {version}; |
@@ -9,4 +9,7 @@ (function (global, factory) { | ||
var timeout = 0; | ||
var interval = 0; | ||
var maxDelay = 5000; | ||
var taskHead; | ||
var taskTail; | ||
var clockLast = 0; | ||
var clockNow = 0; | ||
@@ -66,5 +69,5 @@ var clock = typeof performance === "object" ? performance : Date; | ||
++frame; // Pretend we’ve set an alarm, if we haven’t already. | ||
var t = taskHead; | ||
var t = taskHead, e; | ||
while (t) { | ||
if (clockNow >= t._time) t._call.call(null, clockNow - t._time); | ||
if ((e = clockNow - t._time) >= 0) t._call.call(null, e); | ||
t = t._next; | ||
@@ -76,3 +79,3 @@ } | ||
function wake(time) { | ||
clockNow = time || clock.now(); | ||
clockLast = clockNow = time || clock.now(); | ||
frame = timeout = 0; | ||
@@ -88,2 +91,8 @@ try { | ||
function poke() { | ||
if (clock.now() - clockLast > maxDelay) { | ||
wake(); | ||
} | ||
} | ||
function nap() { | ||
@@ -107,7 +116,12 @@ var t0, t1 = taskHead, time = Infinity; | ||
var delay = time - clockNow; | ||
if (delay > 24) { if (time < Infinity) timeout = setTimeout(wake, delay); } | ||
else frame = 1, setFrame(wake); | ||
if (delay > 24) { | ||
if (time < Infinity) timeout = setTimeout(wake, delay); | ||
else if (interval) interval = clearInterval(interval); | ||
} else { | ||
if (!interval) interval = setInterval(poke, maxDelay); | ||
frame = 1, setFrame(wake); | ||
} | ||
} | ||
var version = "0.3.0"; | ||
var version = "0.3.1"; | ||
@@ -114,0 +128,0 @@ exports.version = version; |
@@ -1,1 +0,1 @@ | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(t.d3_timer={})}(this,function(t){"use strict";function n(){return p||(y(e),p=h.now())}function e(){p=0}function i(){this._call=this._time=this._next=null}function o(t,n,e){var o=new i;return o.restart(t,n,e),o}function r(t,n,e){var o=new i;return o.restart(function(n){o.stop(),t(n)},n,e),o}function u(){n(),++m;for(var t=a;t;)p>=t._time&&t._call.call(null,p-t._time),t=t._next;--m}function c(t){p=t||h.now(),m=_=0;try{u()}finally{m=0,f(),p=0}}function f(){for(var t,n=a,e=1/0;n;)n._call?(e>n._time&&(e=n._time),n=(t=n)._next):n=t?t._next=n._next:a=n._next;s=t,l(e)}function l(t){if(!m){_&&(_=clearTimeout(_));var n=t-p;n>24?1/0>t&&(_=setTimeout(c,n)):(m=1,y(c))}}var a,s,m=0,_=0,p=0,h="object"==typeof performance?performance:Date,y="function"==typeof requestAnimationFrame?requestAnimationFrame:function(t){return setTimeout(t,17)};i.prototype=o.prototype={restart:function(t,e,i){if("function"!=typeof t)throw new TypeError("callback is not a function");i=(null==i?n():+i)+(null==e?0:+e),this._call||(s?s._next=this:a=this,s=this),this._call=t,this._time=i,l()},stop:function(){this._call&&(this._call=null,this._time=1/0,l())}};var x="0.3.0";t.version=x,t.now=n,t.timer=o,t.timerOnce=r,t.timerFlush=u}); | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(t.d3_timer={})}(this,function(t){"use strict";function n(){return x||(w(e),x=d.now())}function e(){x=0}function i(){this._call=this._time=this._next=null}function o(t,n,e){var o=new i;return o.restart(t,n,e),o}function r(t,n,e){var o=new i;return o.restart(function(n){o.stop(),t(n)},n,e),o}function c(){n(),++_;for(var t,e=s;e;)(t=x-e._time)>=0&&e._call.call(null,t),e=e._next;--_}function u(t){v=x=t||d.now(),_=p=0;try{c()}finally{_=0,l(),x=0}}function f(){d.now()-v>y&&u()}function l(){for(var t,n=s,e=1/0;n;)n._call?(e>n._time&&(e=n._time),n=(t=n)._next):n=t?t._next=n._next:s=n._next;m=t,a(e)}function a(t){if(!_){p&&(p=clearTimeout(p));var n=t-x;n>24?1/0>t?p=setTimeout(u,n):h&&(h=clearInterval(h)):(h||(h=setInterval(f,y)),_=1,w(u))}}var s,m,_=0,p=0,h=0,y=5e3,v=0,x=0,d="object"==typeof performance?performance:Date,w="function"==typeof requestAnimationFrame?requestAnimationFrame:function(t){return setTimeout(t,17)};i.prototype=o.prototype={restart:function(t,e,i){if("function"!=typeof t)throw new TypeError("callback is not a function");i=(null==i?n():+i)+(null==e?0:+e),this._call||(m?m._next=this:s=this,m=this),this._call=t,this._time=i,a()},stop:function(){this._call&&(this._call=null,this._time=1/0,a())}};var T="0.3.1";t.version=T,t.now=n,t.timer=o,t.timerOnce=r,t.timerFlush=c}); |
{ | ||
"name": "d3-timer", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"description": "An efficient queue capable of managing thousands of concurrent animations.", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
var frame = 0, // is an animation frame pending? | ||
timeout = 0, // is a timeout pending? | ||
interval = 0, // are any timers active? | ||
maxDelay = 5000, // the longest we’ll sleep if there are active timers | ||
taskHead, | ||
taskTail, | ||
clockLast = 0, | ||
clockNow = 0, | ||
@@ -60,5 +63,5 @@ clock = typeof performance === "object" ? performance : Date, | ||
++frame; // Pretend we’ve set an alarm, if we haven’t already. | ||
var t = taskHead; | ||
var t = taskHead, e; | ||
while (t) { | ||
if (clockNow >= t._time) t._call.call(null, clockNow - t._time); | ||
if ((e = clockNow - t._time) >= 0) t._call.call(null, e); | ||
t = t._next; | ||
@@ -70,3 +73,3 @@ } | ||
function wake(time) { | ||
clockNow = time || clock.now(); | ||
clockLast = clockNow = time || clock.now(); | ||
frame = timeout = 0; | ||
@@ -82,2 +85,8 @@ try { | ||
function poke() { | ||
if (clock.now() - clockLast > maxDelay) { | ||
wake(); | ||
} | ||
} | ||
function nap() { | ||
@@ -101,4 +110,9 @@ var t0, t1 = taskHead, time = Infinity; | ||
var delay = time - clockNow; | ||
if (delay > 24) { if (time < Infinity) timeout = setTimeout(wake, delay); } | ||
else frame = 1, setFrame(wake); | ||
if (delay > 24) { | ||
if (time < Infinity) timeout = setTimeout(wake, delay); | ||
else if (interval) interval = clearInterval(interval); | ||
} else { | ||
if (!interval) interval = setInterval(poke, maxDelay); | ||
frame = 1, setFrame(wake); | ||
} | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15487
223