NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
npm · #562 most downloaded on npm
An efficient queue capable of managing thousands of concurrent animations.
Last release 5 years ago
no release in 18 months
Release timing varies
gaps range from 3 weeks to 1.2 years
Most releases are documented
notes for 29 of 34 stable releases
Nothing withdrawn
no release was ever pulled
11 years old
35 releases · first in 2015
Update dependencies. Make build reproducible.
This package now requires Node.js 12 or higher. For more, please read Sindre Sorhus’s FAQ .
This package now requires Node.js 12 or higher. For more, please read Sindre Sorhus’s FAQ.
One column per quarter.
v3.0.0
Compare
Fix interval .restart to restart as an interval. Thanks, @katiepark ! #39
This release adopts ES2015 language features such as for-of and drops support for older browsers, including IE. If you need to support pre-ES2015 environments, you should stick with d3-timer 1.x or use a transpiler.
Nothing published for this version
Adopt explicit files for publishing.
Housekeeping.
Update dependencies.
Fix sleeping for too long when timer invocation is expensive.
Fix invocation of requestAnimationFrame in Edge. Thanks, @KonradKlimczak .
Update dependencies.
Fix calculation of clock skew when page is backgrounded before timers are scheduled.
Fix for invalid _timestamp_ argument in requestAnimationFrame in RStudio (#16).
Add module entry point to package.json.
module entry point to package.json.Fix for missing performance.now in IE9 (d3/d3-force#39).
In D3 3.x, the only way to stop a timer was for its callback to return true. For example, this timer stops after one second:
In D3 3.x, the only way to stop a timer was for its callback to return true. For example, this timer stops after one second:
d3.timer(function(elapsed) {
console.log(elapsed);
return elapsed >= 1000;
});
In 4.0, use timer.stop instead:
var t = d3.timer(function(elapsed) {
console.log(elapsed);
if (elapsed >= 1000) {
t.stop();
}
});
The primary benefit of timer.stop is that timers are not required to self-terminate: they can be stopped externally, allowing for the immediate and synchronous disposal of associated resources, and the separation of concerns. The above is equivalent to:
var t = d3.timer(function(elapsed) {
console.log(elapsed);
});
d3.timeout(function() {
t.stop();
}, 1000);
This improvement extends to d3-transition: now when a transition is interrupted, its resources are immediately freed rather than having to wait for transition to start.
4.0 also introduces a new timer.restart method for restarting timers, for replacing the callback of a running timer, or for changing its delay or reference time. Unlike timer.stop followed by d3.timer, timer.restart maintains the invocation priority of an existing timer: it guarantees that the order of invocation of active timers remains the same. The d3.timer.flush method has been renamed to d3.timerFlush.
Some usage patterns in D3 3.x could cause the browser to hang when a background page returned to the foreground. For example, the following code schedules a transition every second:
setInterval(function() {
d3.selectAll("div").transition().call(someAnimation); // BAD
}, 1000);
If such code runs in the background for hours, thousands of queued transitions will try to run simultaneously when the page is foregrounded. D3 4.0 avoids this hang by freezing time in the background: when a page is in the background, time does not advance, and so no queue of timers accumulates to run when the page returns to the foreground. Use d3.timer instead of transitions to schedule a long-running animation, or use d3.timeout and d3.interval in place of setTimeout and setInterval to prevent transitions from being queued in the background:
d3.interval(function() {
d3.selectAll("div").transition().call(someAnimation); // GOOD
}, 1000);
By freezing time in the background, timers are effectively “unaware” of being backgrounded. It’s like nothing happened! 4.0 also now uses high-precision time (performance.now) where available; the current time is available as d3.now.
See CHANGES for all D3 changes since 3.x.
Fix _timer_.restart for stopped timers in non-empty queues (d3/d3-force#34).
Export to the global d3 in vanilla environments (d3/d3#2840).
d3 in vanilla environments (d3/d3#2840).Fix current time on iOS 8 (#12).
Fix infinite loop when calling _timer_.restart immediately after _timer_.stop, again.
Fix infinite loop when calling _timer_.restart immediately after _timer_.stop.
- Fix _timer_.constructor (#11).
Rename d3.timerOnce to d3.timeout.
Freeze time in the background, rather than periodically flushing the queue (#6).
Flush the queue every five seconds while in the background (#6).
Remove the _now_ argument to timer callbacks.
- Remove _timer_.id. - Improve performance.
- Add timerOnce.
Nothing published for this version
Nothing published for this version
Define d3-timer module (and d3_timer global), not timer.
d3-timer module (and d3_timer global), not timer.Adjust package.json definition for npm users.
Remove requestAnimationFrame polyfill.
Nothing published for this version
Nothing published for this version
Nothing published for this version
Your coding agent can read these notes before it upgrades. Set up the MCP server →