Saltar al contenido

Referencia de la API node:timers

Cómo admite Elide los módulos timers y timers/promises de Node: coinciden con Node, incluido scheduler; active() y unenroll() no están expuestos.

Leer sin conexiónelide help --lang es api-node-timers

En esta página

node:timers exporta temporizadores con funciones de retorno: setTimeout / clearTimeout, setInterval / clearInterval y setImmediate / clearImmediate. Ofrecen la misma API que los globales de temporizador, pero no son los mismos objetos de función JavaScript. No se exponen los métodos heredados active() y unenroll().

node:timers/promises

Exportación Propósito
setTimeout(delay?, value?, options?) Se resuelve con value tras el retardo.
setImmediate(value?, options?) Se resuelve en un turno inmediato.
setInterval(delay?, value?, options?) Produce un iterador asíncrono.
scheduler Proporciona wait() y yield().

Los temporizadores con Promise aceptan un AbortSignal y se rechazan con AbortError cuando se aborta. Los temporizadores pendientes, con funciones de retorno o con Promise, mantienen vivo un proceso elide run independiente hasta que terminan.

Véase también

Reference

Status: Full · 54 of 57 suite tests pass (94.7%) · since 1.1.0

Exports

Export Kind Status Notes
setTimeout() function Full Schedules a callback to be invoked once after delay milliseconds
clearTimeout() function Full Cancels a timeout previously established by setTimeout()
setInterval() function Full Schedules a callback to be invoked repeatedly every delay milliseconds
clearInterval() function Full Cancels an interval previously established by setInterval()
setImmediate() function Full Schedules a callback to be invoked asynchronously “immediately” (after I/O events but before timers…
clearImmediate() function Full Cancels an immediate action previously established by setImmediate()

Tests: node-api node:timers: 54 pass, 3 fail, 0 error, 10 skipped. Failing: test-timers-max-duration-warning.js, test-timers-timeout-to-interval.js, test-timers-unenroll-unref-interval.js.

¿Te resultó útil esta página?