Gives the ability to get the current time, schedule a single wake() call, create a repeater that will allow scheduling of events at regular intervals, or remove scheduled calls.

interface TimerServiceI {
    cancel: ((cancelToken) => void);
    delay: ((delay, cancelToken?) => Promise<TimestampRecord>);
    getClock: (() => Clock);
    getCurrentTimestamp: (() => TimestampRecord);
    getTimerBrand: (() => TimerBrand);
    makeNotifier: ((delay, interval, cancelToken?) => Notifier<TimestampRecord>);
    makeRepeater: ((delay, interval, cancelToken?) => TimerRepeater);
    repeatAfter: ((delay, interval, handler, cancelToken?) => void);
    setWakeup: ((baseTime, waker, cancelToken?) => TimestampRecord);
    wakeAt: ((baseTime, cancelToken?) => Promise<TimestampRecord>);
}

Properties

cancel: ((cancelToken) => void)

Cancel a previously-established wakeup or repeater.

Type declaration

    • (cancelToken): void
    • Parameters

      • cancelToken: object

      Returns void

delay: ((delay, cancelToken?) => Promise<TimestampRecord>)

Create and return a promise that will resolve after the relative time has passed.

Type declaration

getClock: (() => Clock)

Retrieve the read-only Clock facet.

Type declaration

getCurrentTimestamp: (() => TimestampRecord)

Retrieve the latest timestamp

Type declaration

getTimerBrand: (() => TimerBrand)

Retrieve the Brand for this timer service.

Type declaration

makeNotifier: ((delay, interval, cancelToken?) => Notifier<TimestampRecord>)

Create and return a Notifier that will deliver updates repeatedly at times that are a multiple of interval following delay.

Type declaration

makeRepeater: ((delay, interval, cancelToken?) => TimerRepeater)

Create and return a repeater that will schedule wake() calls repeatedly at times that are a multiple of interval following delay. Interval is the difference between successive times at which wake will be called. When schedule(w) is called, w.wake() will be scheduled to be called after the next multiple of interval from the base. Since times can be coarse-grained, the actual call may occur later, but this won't change when the next event will be called.

Type declaration

repeatAfter: ((delay, interval, handler, cancelToken?) => void)

Create a repeater with a handler directly.

Type declaration

setWakeup: ((baseTime, waker, cancelToken?) => TimestampRecord)

Return value is the time at which the call is scheduled to take place

Type declaration

wakeAt: ((baseTime, cancelToken?) => Promise<TimestampRecord>)

Create and return a promise that will resolve after the absolute time has passed.

Type declaration