Security News
Introducing the Socket Python SDK
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
setTimeout
and setInterval
with unref
and ref
like in node.jsPlease only use this in the browser, not in node.
npm install timers-ref
var timers = require('timers-ref')
timers.setTimeout(function () {
console.log('hi')
}, 100)
timers.setInterval(function () {
console.log('hi')
}, 100)
var timeout = timers.setTimeout(function () {}, 100)
timers.clearTimeout(timeout)
var interval = timers.setInterval(function () {}, 100)
timers.clearInterval(interval)
If you want to listen to process.on('exit')
to know when there are no setTimeout
or setInterval
timers in the event queue, do this:
timers.setupProcess()
process.once('exit', function (code) {
console.log('all done')
})
Note one important difference: This won't emit process.on('exit') if no setTimeouts or setIntervals are called. Needs at least one call to get things going.
MIT. Copyright (c) Feross Aboukhadijeh.
FAQs
`setTimeout` and `setInterval` with `unref` and `ref` like in node.js
The npm package timers-ref receives a total of 9 weekly downloads. As such, timers-ref popularity was classified as not popular.
We found that timers-ref 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
The initial version of the Socket Python SDK is now on PyPI, enabling developers to more easily interact with the Socket REST API in Python projects.
Security News
Floating dependency ranges in npm can introduce instability and security risks into your project by allowing unverified or incompatible versions to be installed automatically, leading to unpredictable behavior and potential conflicts.
Security News
A new Rust RFC proposes "Trusted Publishing" for Crates.io, introducing short-lived access tokens via OIDC to improve security and reduce risks associated with long-lived API tokens.