Comparing version 0.4.1 to 0.4.2
@@ -7,2 +7,4 @@ (function (global, factory) { | ||
var version = "0.4.2"; | ||
var frame = 0; | ||
@@ -38,3 +40,3 @@ var timeout = 0; | ||
time = (time == null ? now() : +time) + (delay == null ? 0 : +delay); | ||
if (!this._call) { | ||
if (!this._call && taskTail !== this) { | ||
if (taskTail) taskTail._next = this; | ||
@@ -140,4 +142,2 @@ else taskHead = this; | ||
var version = "0.4.1"; | ||
exports.version = version; | ||
@@ -144,0 +144,0 @@ exports.now = now; |
@@ -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=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}); | ||
!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 w||(F(e),w=b.now()+T)}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(),++h;for(var t,e=m;e;)(t=w-e._time)>=0&&e._call.call(null,t),e=e._next;--h}function u(t){w=(d=t||b.now())+T,h=v=0;try{o()}finally{h=0,c(),w=0}}function l(){var t=b.now(),n=t-d;n>x&&(T-=n,d=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(!h){v&&(v=clearTimeout(v));var n=t-w;n>24?(1/0>t&&(v=setTimeout(u,n)),y&&(y=clearInterval(y))):(y||(y=setInterval(l,x)),h=1,F(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.4.2",h=0,v=0,y=0,x=1e3,d=0,w=0,T=0,b="object"==typeof performance?performance:Date,F="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||_===this||(_?_._next=this:m=this,_=this),this._call=t,this._time=i,a()},stop:function(){this._call&&(this._call=null,this._time=1/0,a())}},t.version=p,t.now=n,t.timer=r,t.timerFlush=o,t.timeout=f,t.interval=s}); |
export { | ||
version | ||
} from "./build/package"; | ||
export { | ||
now, | ||
@@ -3,0 +7,0 @@ timer, |
{ | ||
"name": "d3-timer", | ||
"version": "0.4.1", | ||
"version": "0.4.2", | ||
"description": "An efficient queue capable of managing thousands of concurrent animations.", | ||
@@ -27,9 +27,9 @@ "keywords": [ | ||
"scripts": { | ||
"pretest": "mkdir -p build && node -e 'process.stdout.write(\"var version = \\\"\" + require(\"./package.json\").version + \"\\\"; export * from \\\"../index\\\"; export {version};\");' > build/bundle.js && rollup -f umd -n d3_timer -o build/d3-timer.js -- build/bundle.js", | ||
"test": "faucet `find test -name '*-test.js'` && eslint index.js src", | ||
"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 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" | ||
"pretest": "rm -rf build && mkdir build && json2module package.json > build/package.js && rollup -f umd -n d3_timer -o build/d3-timer.js -- index.js", | ||
"test": "tape 'test/**/*-test.js' && eslint index.js src", | ||
"prepublish": "npm run test && uglifyjs build/d3-timer.js -c -m -o build/d3-timer.min.js", | ||
"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 && cd - && zip -j build/d3-timer.zip -- LICENSE README.md build/d3-timer.js build/d3-timer.min.js" | ||
}, | ||
"devDependencies": { | ||
"faucet": "0.0", | ||
"json2module": "0.0", | ||
"rollup": "0.25", | ||
@@ -36,0 +36,0 @@ "tape": "4", |
@@ -7,9 +7,14 @@ # d3-timer | ||
If you use NPM, `npm install d3-timer`. Otherwise, download the [latest release](https://github.com/d3/d3-timer/releases/latest). The released bundle supports AMD, CommonJS, and vanilla environments. Create a custom build using [Rollup](https://github.com/rollup/rollup) or your preferred bundler. You can also load directly from [d3js.org](https://d3js.org): | ||
If you use NPM, `npm install d3-timer`. Otherwise, download the [latest release](https://github.com/d3/d3-timer/releases/latest). You can also load directly from [d3js.org](https://d3js.org), either as a [standalone library](https://d3js.org/d3-timer.v0.4.min.js) or as part of [D3 4.0 alpha](https://github.com/mbostock/d3/tree/4). AMD, CommonJS, and vanilla environments are supported. In vanilla, a `d3_timer` global is exported: | ||
```html | ||
<script src="https://d3js.org/d3-timer.v0.3.min.js"></script> | ||
<script src="https://d3js.org/d3-timer.v0.4.min.js"></script> | ||
<script> | ||
var timer = d3_timer.timer(callback); | ||
</script> | ||
``` | ||
In a vanilla environment, a `d3_timer` global is exported. [Try d3-timer in your browser.](https://tonicdev.com/npm/d3-timer) | ||
[Try d3-timer in your browser.](https://tonicdev.com/npm/d3-timer) | ||
@@ -16,0 +21,0 @@ ## API Reference |
@@ -32,3 +32,3 @@ var frame = 0, // is an animation frame pending? | ||
time = (time == null ? now() : +time) + (delay == null ? 0 : +delay); | ||
if (!this._call) { | ||
if (!this._call && taskTail !== this) { | ||
if (taskTail) taskTail._next = this; | ||
@@ -35,0 +35,0 @@ else taskHead = this; |
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
19330
279
78