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: object) => void);
    delay: ((delay: RelativeTime, cancelToken?: object) => Promise<TimestampRecord>);
    getClock: (() => Clock);
    getCurrentTimestamp: (() => TimestampRecord);
    getTimerBrand: (() => TimerBrand);
    makeNotifier: ((delay: RelativeTime, interval: RelativeTime, cancelToken?: object) => Notifier<TimestampRecord>);
    makeRepeater: ((delay: RelativeTime, interval: RelativeTime, cancelToken?: object) => TimerRepeater);
    repeatAfter: ((delay: RelativeTime, interval: RelativeTime, handler: TimerWaker, cancelToken?: object) => void);
    setWakeup: ((baseTime: Timestamp, waker: ERef<TimerWaker>, cancelToken?: object) => TimestampRecord);
    wakeAt: ((baseTime: Timestamp, cancelToken?: object) => Promise<TimestampRecord>);
}

Properties

cancel: ((cancelToken: object) => void)

Cancel a previously-established wakeup or repeater.

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

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

getClock: (() => Clock)

Retrieve the read-only Clock facet.

getCurrentTimestamp: (() => TimestampRecord)

Retrieve the latest timestamp

getTimerBrand: (() => TimerBrand)

Retrieve the Brand for this timer service.

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

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

makeRepeater: ((delay: RelativeTime, interval: RelativeTime, cancelToken?: object) => 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.

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

Create a repeater with a handler directly.

setWakeup: ((baseTime: Timestamp, waker: ERef<TimerWaker>, cancelToken?: object) => TimestampRecord)

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

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

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