PythonMonkey   v1.0.0 (dev)
Loading...
Searching...
No Matches
Timeout Class Reference

Public Member Functions

 constructor (numericId)
 
 hasRef ()
 
 ref ()
 
 unref ()
 
 refresh ()
 
 close ()
 

Detailed Description

Implement Node.js-style timeoutId class returned from setTimeout() and setInterval()

See also
https://nodejs.org/api/timers.html#class-timeout

Member Function Documentation

◆ close()

Timeout::close ( )

Cancels the timeout.

Deprecated:
legacy Node.js API. Use clearTimeout() instead

◆ constructor()

Timeout::constructor (   numericId)

@type {number} an integer

Parameters
{number}numericId

◆ hasRef()

Timeout::hasRef ( )

If true, the Timeout object will keep the event-loop active.

Returns
{boolean}

◆ ref()

Timeout::ref ( )

When called, requests that the event-loop not exit so long as the Timeout is active.

By default, all Timeout objects are "ref'ed", making it normally unnecessary to call timeout.ref() unless timeout.unref() had been called previously.

◆ refresh()

Timeout::refresh ( )

Sets the timer's start time to the current time, and reschedules the timer to call its callback at the previously specified duration adjusted to the current time.

Using this on a timer that has already called its callback will reactivate the timer.

◆ unref()

Timeout::unref ( )

When called, the active Timeout object will not require the event-loop to remain active.
If there is no other activity keeping the event-loop running, the process may exit before the Timeout object's callback is invoked.


The documentation for this class was generated from the following file: