Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

d3-timer

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

d3-timer - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

build/timer.cjs.js

22

build/timer.js

@@ -25,3 +25,3 @@ (function (global, factory) {

function timer(callback, delay, time) {
if (time == null) time = Date.now(); else time = +time;
time = time == null ? Date.now() : +time;
if (delay != null) time += +delay;

@@ -35,14 +35,19 @@

wakeAt(time);
}// Replace the current timer. Only allowed within a timer callback.
// Set an alarm to wake up for the timer’s first tick, if necessary.
if (!frame && !active) wakeAt(time);
};
// Replace the current timer. Only allowed within a timer callback.
function timerReplace(callback, delay, time) {
if (time == null) time = Date.now(); else time = +time;
time = time == null ? Date.now() : +time;
if (delay != null) time += +delay;
active.callback = callback;
active.time = time;
}// Execute all eligible timers,
};
// Execute all eligible timers,
// then flush completed timers to avoid concurrent queue modification.
// Returns the time of the earliest active timer.
function timerFlush(time) {
if (time == null) time = Date.now(); else time = +time;
time = time == null ? Date.now() : +time;
var active0 = active;

@@ -74,3 +79,5 @@

return time;
}function wake() {
};
function wake() {
frame = timeout = 0, timeoutTime = Infinity;

@@ -81,3 +88,2 @@ wakeAt(timerFlush());

function wakeAt(time) {
if (frame) return; // Fastest wake already set.
var delay = time - Date.now();

@@ -84,0 +90,0 @@ if (delay > 24) {

@@ -1,1 +0,1 @@

!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(e.timer={})}(this,function(e){"use strict";function n(e,n,t){t=null==t?Date.now():+t,null!=n&&(t+=+n);var i={callback:e,time:t,flush:!1,next:null};m?m.next=i:a=i,m=i,u(t)}function t(e,n,t){t=null==t?Date.now():+t,null!=n&&(t+=+n),r.callback=e,r.time=t}function i(e){e=null==e?Date.now():+e;var n=r;for(r=a;r;)e>=r.time&&(r.flush=r.callback(e-r.time,e)),r=r.next;r=n,e=1/0;for(var t,i=a;i;)i.flush?i=t?t.next=i.next:a=i.next:(i.time<e&&(e=i.time),i=(t=i).next);return m=t,e}function o(){l=f=0,c=1/0,u(i())}function u(e){if(!l){var n=e-Date.now();n>24?c>e&&(f&&clearTimeout(f),f=setTimeout(o,n),c=e):(f&&(f=clearTimeout(f),c=1/0),l=s(o))}}var a,m,r,l,f,c=1/0,s="undefined"!=typeof window&&(window.requestAnimationFrame||window.msRequestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.oRequestAnimationFrame)||function(e){return setTimeout(e,17)};e.timer=n,e.timerReplace=t,e.timerFlush=i});
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports):"function"==typeof define&&define.amd?define(["exports"],n):n(e.timer={})}(this,function(e){"use strict";function n(e,n,t){t=null==t?Date.now():+t,null!=n&&(t+=+n);var i={callback:e,time:t,flush:!1,next:null};m?m.next=i:a=i,m=i,l||r||u(t)}function t(e,n,t){t=null==t?Date.now():+t,null!=n&&(t+=+n),r.callback=e,r.time=t}function i(e){e=null==e?Date.now():+e;var n=r;for(r=a;r;)e>=r.time&&(r.flush=r.callback(e-r.time,e)),r=r.next;r=n,e=1/0;for(var t,i=a;i;)i.flush?i=t?t.next=i.next:a=i.next:(i.time<e&&(e=i.time),i=(t=i).next);return m=t,e}function o(){l=f=0,c=1/0,u(i())}function u(e){var n=e-Date.now();n>24?c>e&&(f&&clearTimeout(f),f=setTimeout(o,n),c=e):(f&&(f=clearTimeout(f),c=1/0),l=s(o))}var a,m,r,l,f,c=1/0,s="undefined"!=typeof window&&(window.requestAnimationFrame||window.msRequestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.oRequestAnimationFrame)||function(e){return setTimeout(e,17)};e.timer=n,e.timerReplace=t,e.timerFlush=i});
{
"name": "d3-timer",
"version": "0.0.4",
"version": "0.0.5",
"description": "An efficient queue capable of managing thousands of concurrent animations.",

@@ -20,3 +20,3 @@ "keywords": [

},
"main": "build/timer",
"main": "build/timer.cjs",
"jsnext:main": "index",

@@ -28,8 +28,8 @@ "repository": {

"scripts": {
"pretest": "mkdir -p build && d3-bundler --format=umd --name=timer -- index.js > build/timer.js",
"pretest": "mkdir -p build && d3-bundler -x -f cjs -o build/timer.cjs.js",
"test": "faucet `find test -name '*-test.js'`",
"prepublish": "npm run test && uglifyjs build/timer.js -c -m -o build/timer.min.js && rm -f build/timer.zip && zip -j build/timer.zip -- LICENSE README.md build/timer.js build/timer.min.js"
"prepublish": "npm run test && d3-bundler -n timer -o build/timer.js && uglifyjs build/timer.js -c -m -o build/timer.min.js && rm -f build/timer.zip && zip -j build/timer.zip -- LICENSE README.md build/timer.js build/timer.min.js"
},
"devDependencies": {
"d3-bundler": "~0.3.0",
"d3-bundler": "~0.4.0",
"faucet": "0.0",

@@ -36,0 +36,0 @@ "tape": "4",

@@ -18,3 +18,3 @@ var queueHead,

export function timer(callback, delay, time) {
if (time == null) time = Date.now(); else time = +time;
time = time == null ? Date.now() : +time;
if (delay != null) time += +delay;

@@ -28,3 +28,4 @@

wakeAt(time);
// Set an alarm to wake up for the timer’s first tick, if necessary.
if (!frame && !active) wakeAt(time);
};

@@ -34,3 +35,3 @@

export function timerReplace(callback, delay, time) {
if (time == null) time = Date.now(); else time = +time;
time = time == null ? Date.now() : +time;
if (delay != null) time += +delay;

@@ -45,3 +46,3 @@ active.callback = callback;

export function timerFlush(time) {
if (time == null) time = Date.now(); else time = +time;
time = time == null ? Date.now() : +time;
var active0 = active;

@@ -81,3 +82,2 @@

function wakeAt(time) {
if (frame) return; // Fastest wake already set.
var delay = time - Date.now();

@@ -84,0 +84,0 @@ if (delay > 24) {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc