Options
All
  • Public
  • Public/Protected
  • All
Menu

Module node_modules/@types/sinonjs__fake-timers

Index

Type aliases

BrowserClock

BrowserClock: FakeClock<number>

Fake clock for a browser environment.

Clock

Clock object created by @sinonjs/fake-timers.

FakeMethod

FakeMethod: "setTimeout" | "clearTimeout" | "setImmediate" | "clearImmediate" | "setInterval" | "clearInterval" | "Date" | "nextTick" | "hrtime" | "requestAnimationFrame" | "cancelAnimationFrame" | "requestIdleCallback" | "cancelIdleCallback" | "performance" | "queueMicrotask"

Names of clock methods that may be faked by install.

InstalledClock

InstalledClock: Clock & InstalledMethods

Clock object created by calling install();.

NodeClock

NodeClock: FakeClock<NodeTimer> & { hrtime: any; nextTick: any; queueMicrotask: any; runMicrotasks: any }

Fake clock for a Node environment.

TimerId

TimerId: number | NodeTimer

Timer identifier for clock scheduling.

Variables

Const timers

Functions

createClock

  • createClock(now?: number | Date, loopLimit?: number): Clock
  • Creates a clock.

    remarks

    The default epoch is 0.

    Parameters

    • Optional now: number | Date

      Current time for the clock.

    • Optional loopLimit: number

      Maximum number of timers that will be run when calling runAll() before assuming that we have an infinite loop and throwing an error (by default, 1000).

    Returns Clock

install

  • Creates a clock and installs it globally.

    Parameters

    Returns InstalledClock

withGlobal

  • Apply new context to fake timers.

    Parameters

    • global: object

      New context to apply like window (in browsers) or global (in node).

    Returns FakeTimerWithContext