Timer that will send the current time on its channel after at least duration millisecond.

Hierarchy

  • Timer

Properties

Accessors

c

Methods

Properties

c_: undefined | Chan<Date>
callback?: ValueCallback<Date>
t_: undefined | number

Accessors

Methods

  • Reset changes the timer to expire after duration millisecond.

    Returns

    returns true if the timer had been active, false if the timer had expired or been stopped.

    Parameters

    • ms: number

    Returns boolean

  • Stop prevents the Timer from firing.

    Remarks

    Stop does not close the channel, to prevent a read from the channel succeeding incorrectly.

    To ensure the channel is empty after a call to Stop, check the return value and drain the channel. For example, assuming the program has not received from t.C already:

    if (!t.Stop()) {
    t.c.tryRead()
    }

    Returns

    It returns true if the call stops the timer, false if the timer has already expired or been stopped.

    Returns boolean

Generated using TypeDoc