Skip to content

SetTimeout

[<Interface>]
type SetTimeout =
    abstract member Invoke (callback: unit -> unit, ?delay: float) : Timeout
    abstract member Invoke<'TArgs> (callback: 'TArgs -> unit, delay: float option, args: 'TArgs) : Timeout
    abstract member __promisify__<'T> (?delay: float, ?value: 'T, ?options: TimerOptions) : Promise<'T>
AssemblyXantham.Fable.Node

Methods

abstract member Invoke (callback: unit -> unit, ?delay: float) : Timeout

Schedules execution of a one-time callback after delay milliseconds.

The callback will likely not be invoked in precisely delay milliseconds. Node.js makes no guarantees about the exact timing of when callbacks will fire, nor of their ordering. The callback will be called as close as possible to the time specified.

When delay is larger than 2147483647 or less than 1 or NaN, the delay will be set to 1. Non-integer delays are truncated to an integer.

If callback is not a function, a TypeError will be thrown.

This method has a custom variant for promises that is available using timersPromises.setTimeout().

@since v0.0.1

Parameter
callbackThe function to call when the timer elapses.
delayThe number of milliseconds to wait before calling the callback. Default:1.
argsOptional arguments to pass when the callback is called.

Returns. for use with clearTimeout()

abstract member Invoke<'TArgs> (callback: 'TArgs -> unit, delay: float option, args: 'TArgs) : Timeout

Schedules execution of a one-time callback after delay milliseconds.

The callback will likely not be invoked in precisely delay milliseconds. Node.js makes no guarantees about the exact timing of when callbacks will fire, nor of their ordering. The callback will be called as close as possible to the time specified.

When delay is larger than 2147483647 or less than 1 or NaN, the delay will be set to 1. Non-integer delays are truncated to an integer.

If callback is not a function, a TypeError will be thrown.

This method has a custom variant for promises that is available using timersPromises.setTimeout().

@since v0.0.1

Parameter
callbackThe function to call when the timer elapses.
delayThe number of milliseconds to wait before calling the callback. Default:1.
argsOptional arguments to pass when the callback is called.

Returns. for use with clearTimeout()

abstract member __promisify__<'T> (?delay: float, ?value: 'T, ?options: TimerOptions) : Promise<'T>