Skip to content

d3.stop() should return the time it was stopped at #51

Description

@tansanDOTeth

I was looking into how I can gracefully resume a timer that might have been stopped and thought this would have been a natural choice, but noticed the function didn't return anything. This is helpful for pausing and resuming mid-way through an animation. If I restarted the timer, it will likely interrupt the timer and restart the animation.

const hello = (elapsedTime) => console.log("hello world", elapsedTime)
const timer = d3.timer(hello)

setTImeout(() => {
    const stoppedTime = timer.stop()
    setTImeout(() => {
        timer.restart(hello, null, stoppedTime)  
     }, 5000)
}, 5000)

Is there a way to achieve something similar?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions