@types/d3-timer

  • Version 3.0.2
  • Published
  • 6.75 kB
  • No dependencies
  • MIT license

Install

npm i @types/d3-timer
yarn add @types/d3-timer
pnpm add @types/d3-timer

Overview

TypeScript definitions for d3-timer

Index

Functions

function interval

interval: (
callback: (elapsed: number) => void,
delay?: number,
time?: number
) => Timer;
  • Schedules and returns a new timer, invoking the specified callback repeatedly every 'delay' milliseconds until the timer is stopped. The callback is passed the (apparent) elapsed time since the timer became active.

    Parameter callback

    A callback function to be invoked and passed in the apparent elapsed time since the timer became active in milliseconds.

    Parameter delay

    An optional numeric delay in milliseconds between repeat invocations of the callback. If not specified, the interval timer behaves like the regular timer.

    Parameter time

    An optional time in milliseconds relative to which the initial delay is calculated (default = now).

function now

now: () => number;
  • Returns the current time as defined by performance.now if available, and Date.now if not. The current time is updated at the start of a frame; it is thus consistent during the frame, and any timers scheduled during the same frame will be synchronized. If this method is called outside of a frame, such as in response to a user event, the current time is calculated and then fixed until the next frame, again ensuring consistent timing during event handling.

function timeout

timeout: (
callback: (elapsed: number) => void,
delay?: number,
time?: number
) => Timer;
  • Schedules and returns a new timer, invoking the specified callback. The timer is stopped automatically on its first callback. The callback is passed the (apparent) elapsed time since the timer became active.

    Parameter callback

    A callback function to be invoked and passed in the apparent elapsed time since the timer became active in milliseconds.

    Parameter delay

    An optional numeric delay in milliseconds (default = 0) relative to time.

    Parameter time

    An optional time in milliseconds relative to which the delay is calculated (default = now).

function timer

timer: (
callback: (elapsed: number) => void,
delay?: number,
time?: number
) => Timer;
  • Schedules and returns a new timer, invoking the specified callback repeatedly until the timer is stopped. The callback is passed the (apparent) elapsed time since the timer became active.

    Parameter callback

    A callback function to be invoked and passed in the apparent elapsed time since the timer became active in milliseconds.

    Parameter delay

    An optional numeric delay in milliseconds (default = 0) relative to time.

    Parameter time

    An optional time in milliseconds relative to which the delay is calculated (default = now).

function timerFlush

timerFlush: () => void;
  • Immediately invoke any eligible timer callbacks.

Interfaces

interface Timer

interface Timer {}

    method restart

    restart: (
    callbackFn: (elapsed: number) => void,
    delay?: number,
    time?: number
    ) => void;
    • Restart a timer with the specified callback and optional delay and time. This is equivalent to stopping this timer and creating a new timer with the specified arguments, although this timer retains the original invocation priority.

      Parameter callback

      A callback function to be invoked and passed in the apparent elapsed time since the timer became active in milliseconds.

      Parameter delay

      An optional numeric delay in milliseconds (default = 0) relative to time.

      Parameter time

      An optional time in milliseconds relative to which the delay is calculated (default = now).

    method stop

    stop: () => void;
    • Stop the timer.

    Package Files (1)

    Dependencies (0)

    No dependencies.

    Dev Dependencies (0)

    No dev dependencies.

    Peer Dependencies (0)

    No peer dependencies.

    Badge

    To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

    You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/d3-timer.

    • Markdown
      [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/d3-timer)
    • HTML
      <a href="https://www.jsdocs.io/package/@types/d3-timer"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>