Timers Promises API, for node 14 and below.
const timers = require('timers-promises')
const AbortController = require('abort-controller')
await timers.setTimeout(5000)
// With abort
const controller = new AbortController()
await timers.setTimeout(10000, 'value', {
signal: controller.signal
})
// in another context
controller.abort()
See https://nodejs.org/api/timers.html#timers_timers_promises_api.
-
setTimeout([delay[, value[, options]]])
-
setImmediate([value[, options]])
-
setInterval([delay[, value[, options]]])
Development of this module is sponsored by Transloadit.
MIT