-
Notifications
You must be signed in to change notification settings - Fork 41
Closed
Description
I ran into an issue with d3.interval not working as expected when calling restart. If I create a new interval, it works as expected -- firing the callback every delay milliseconds:
const intervalCallback = function(t) {
console.log('interval', t);
if (t > 5000) intervalTest.stop();
};
const intervalTest = d3.interval(intervalCallback, 500);
This outputs:
> interval 515.0400000275113
> interval 1000.9299999801442
> interval 1503.1099999905564
> interval 2000.0850000069477
If I call restart on this instance, passing the same callback and delay, I would expect intervalTest to restart following the same behavior. However, it appears to start a timer (or an interval with 0ms delay) instead.
intervalTest.restart(intervalCallback, 500);
Outputs:
> interval 16.02500001899898
> interval 32.765000010840595
> interval 48.30000002402812
> interval 66.045000043232
> interval 82.05500000622123
...
And so on until the callback reaches its stopping point.
If I'm actually misunderstanding and this isn't how interval is supposed to be used, perhaps something could be added to the docs to clarify?
Let me know if you have any questions, and thanks for your work on this module!
Metadata
Metadata
Assignees
Labels
No labels