Comparing version 0.4.0 to 0.4.1
@@ -1,1 +0,1 @@ | ||
var version = "0.4.0"; export * from "../index"; export {version}; | ||
var version = "0.4.1"; export * from "../index"; export {version}; |
(function (global, factory) { | ||
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : | ||
typeof define === 'function' && define.amd ? define(['exports'], factory) : | ||
(factory((global.d3_timer = {}))); | ||
(factory((global.d3_timer = global.d3_timer || {}))); | ||
}(this, function (exports) { 'use strict'; | ||
@@ -33,2 +33,3 @@ | ||
Timer.prototype = timer.prototype = { | ||
constructor: Timer, | ||
restart: function(callback, delay, time) { | ||
@@ -127,13 +128,14 @@ if (typeof callback !== "function") throw new TypeError("callback is not a function"); | ||
function interval$1(callback, delay, time) { | ||
var t = new Timer, d = delay; | ||
var t = new Timer, total = delay; | ||
if (delay == null) return t.restart(callback, delay, time), t; | ||
delay = +delay, time = time == null ? now() : +time; | ||
t.restart(function tick(elapsed) { | ||
t.restart(tick, d += delay, time); | ||
callback(elapsed - delay + d); | ||
}, d, time); | ||
elapsed += total; | ||
t.restart(tick, total += delay, time); | ||
callback(elapsed); | ||
}, delay, time); | ||
return t; | ||
} | ||
var version = "0.4.0"; | ||
var version = "0.4.1"; | ||
@@ -140,0 +142,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 w||(b(e),w=T.now()+d)}function e(){w=0}function i(){this._call=this._time=this._next=null}function r(t,n,e){var r=new i;return r.restart(t,n,e),r}function o(){n(),++p;for(var t,e=m;e;)(t=w-e._time)>=0&&e._call.call(null,t),e=e._next;--p}function u(t){w=(x=t||T.now())+d,p=h=0;try{o()}finally{p=0,a(),w=0}}function l(){var t=T.now(),n=t-x;n>y&&(d-=n,x=t)}function a(){for(var t,n=m,e=1/0;n;)n._call?(e>n._time&&(e=n._time),n=(t=n)._next):n=t?t._next=n._next:m=n._next;_=t,c(e)}function c(t){if(!p){h&&(h=clearTimeout(h));var n=t-w;n>24?(1/0>t&&(h=setTimeout(u,n)),v&&(v=clearInterval(v))):(v||(v=setInterval(l,y)),p=1,b(u))}}function f(t,n,e){var r=new i;return n=null==n?0:+n,r.restart(function(e){r.stop(),t(e+n)},n,e),r}function s(t,e,r){var o=new i,u=e;return null==e?(o.restart(t,e,r),o):(e=+e,r=null==r?n():+r,o.restart(function l(n){o.restart(l,u+=e,r),t(n-e+u)},u,r),o)}var m,_,p=0,h=0,v=0,y=1e3,x=0,w=0,d=0,T="object"==typeof performance?performance:Date,b="function"==typeof requestAnimationFrame?requestAnimationFrame:function(t){return setTimeout(t,17)};i.prototype=r.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||(_?_._next=this:m=this,_=this),this._call=t,this._time=i,c()},stop:function(){this._call&&(this._call=null,this._time=1/0,c())}};var F="0.4.0";t.version=F,t.now=n,t.timer=r,t.timerFlush=o,t.timeout=f,t.interval=s}); | ||
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(t.d3_timer=t.d3_timer||{})}(this,function(t){"use strict";function n(){return d||(b(e),d=T.now()+w)}function e(){d=0}function i(){this._call=this._time=this._next=null}function r(t,n,e){var r=new i;return r.restart(t,n,e),r}function o(){n(),++p;for(var t,e=m;e;)(t=d-e._time)>=0&&e._call.call(null,t),e=e._next;--p}function u(t){d=(x=t||T.now())+w,p=h=0;try{o()}finally{p=0,c(),d=0}}function l(){var t=T.now(),n=t-x;n>y&&(w-=n,x=t)}function c(){for(var t,n=m,e=1/0;n;)n._call?(e>n._time&&(e=n._time),n=(t=n)._next):n=t?t._next=n._next:m=n._next;_=t,a(e)}function a(t){if(!p){h&&(h=clearTimeout(h));var n=t-d;n>24?(1/0>t&&(h=setTimeout(u,n)),v&&(v=clearInterval(v))):(v||(v=setInterval(l,y)),p=1,b(u))}}function f(t,n,e){var r=new i;return n=null==n?0:+n,r.restart(function(e){r.stop(),t(e+n)},n,e),r}function s(t,e,r){var o=new i,u=e;return null==e?(o.restart(t,e,r),o):(e=+e,r=null==r?n():+r,o.restart(function l(n){n+=u,o.restart(l,u+=e,r),t(n)},e,r),o)}var m,_,p=0,h=0,v=0,y=1e3,x=0,d=0,w=0,T="object"==typeof performance?performance:Date,b="function"==typeof requestAnimationFrame?requestAnimationFrame:function(t){return setTimeout(t,17)};i.prototype=r.prototype={constructor:i,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||(_?_._next=this:m=this,_=this),this._call=t,this._time=i,a()},stop:function(){this._call&&(this._call=null,this._time=1/0,a())}};var F="0.4.1";t.version=F,t.now=n,t.timer=r,t.timerFlush=o,t.timeout=f,t.interval=s}); |
{ | ||
"name": "d3-timer", | ||
"version": "0.4.0", | ||
"version": "0.4.1", | ||
"description": "An efficient queue capable of managing thousands of concurrent animations.", | ||
@@ -30,3 +30,3 @@ "keywords": [ | ||
"prepublish": "npm run test && uglifyjs build/d3-timer.js -c -m -o build/d3-timer.min.js && rm -f build/d3-timer.zip && zip -j build/d3-timer.zip -- LICENSE README.md build/d3-timer.js build/d3-timer.min.js", | ||
"postpublish": "VERSION=`node -e 'console.log(require(\"./package.json\").version)'`; git push && git tag -am \"Release $VERSION.\" v${VERSION} && git push --tags && cp build/d3-timer.js ../d3.github.com/d3-timer.v0.3.js && cp build/d3-timer.min.js ../d3.github.com/d3-timer.v0.3.min.js && cd ../d3.github.com && git add d3-timer.v0.3.js d3-timer.v0.3.min.js && git commit -m \"d3-timer ${VERSION}\" && git push" | ||
"postpublish": "VERSION=`node -e 'console.log(require(\"./package.json\").version)'`; git push && git push --tags && cp build/d3-timer.js ../d3.github.com/d3-timer.v0.4.js && cp build/d3-timer.min.js ../d3.github.com/d3-timer.v0.4.min.js && cd ../d3.github.com && git add d3-timer.v0.4.js d3-timer.v0.4.min.js && git commit -m \"d3-timer ${VERSION}\" && git push" | ||
}, | ||
@@ -33,0 +33,0 @@ "devDependencies": { |
import {Timer, now} from "./timer"; | ||
export default function(callback, delay, time) { | ||
var t = new Timer, d = delay; | ||
var t = new Timer, total = delay; | ||
if (delay == null) return t.restart(callback, delay, time), t; | ||
delay = +delay, time = time == null ? now() : +time; | ||
t.restart(function tick(elapsed) { | ||
t.restart(tick, d += delay, time); | ||
callback(elapsed - delay + d); | ||
}, d, time); | ||
elapsed += total; | ||
t.restart(tick, total += delay, time); | ||
callback(elapsed); | ||
}, delay, time); | ||
return t; | ||
} |
@@ -28,2 +28,3 @@ var frame = 0, // is an animation frame pending? | ||
Timer.prototype = timer.prototype = { | ||
constructor: Timer, | ||
restart: function(callback, delay, time) { | ||
@@ -30,0 +31,0 @@ if (typeof callback !== "function") throw new TypeError("callback is not a function"); |
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
17934
263