![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Reschedulable setInterval for node.js.
var reInterval = require('reInterval');
var inter = reInterval(function () {
console.log('this should be called after 13s');
}, 10 * 1000);
// This will reset/reschedule the interval after 3 seconds, therefore
// the interval callback won't be called for at least 13 seconds.
setTimeout(function () {
inter.reschedule(10 * 1000);
}, 3 * 1000);
###reInterval(callback, interval[, param1, param2, ...])
This is exactly like setInterval.
Arguments:
callback
: The callback to be executed repeatedly.interval
: The number of milliseconds (thousandths of a second) that the reInterval()
function should wait before each call to callback
.param1, param2, ...
: (OPTIONAL) These arguments are passed to the callback
function.####returns an interval
object with the following methods:
###interval.reschedule([interval])
This function resets the interval
and restarts it now.
Arguments:
interval
: (OPTIONAL) This argument can be used to change the amount of milliseconds to wait before each call to the callback
passed to the reInterval()
function.###interval.clear()
This function clears the interval. Can be used to temporarily clear the interval
, which can be rescheduled at a later time.
###interval.destroy()
This function clears the interval, and will also clear the callback
and params
passed to reInterval, so calling this essentially just makes this object ready for overwriting with a new interval
object.
Please ensure that either the interval.clear()
or interval.destroy()
function is called before overwriting the interval
object, because the internal interval
can continue to run in the background unless cleared.
MIT
FAQs
reschedulable setInterval for node.js
The npm package reinterval receives a total of 980,205 weekly downloads. As such, reinterval popularity was classified as popular.
We found that reinterval demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.