Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
setimmediate
Advanced tools
The setimmediate npm package is a simple and lightweight implementation of the setImmediate API, which is designed to execute a function once the current event loop tick is complete. It is a polyfill for the setImmediate function that is not available in all JavaScript environments, such as older browsers or certain Node.js versions.
Scheduling functions to run after the current event loop tick
This feature allows you to schedule a function to be executed after the current event loop tick has finished. It is useful for deferring execution without using setTimeout with a delay of 0.
require('setimmediate');
setImmediate(() => {
console.log('This will run after the current event loop tick.');
});
Clearing a scheduled immediate
This feature provides the ability to cancel a scheduled immediate, preventing the function from being executed if it has not already been called.
require('setimmediate');
const handle = setImmediate(() => {
console.log('This will not run.');
});
clearImmediate(handle);
Bluebird is a comprehensive promise library that includes a utility for deferring functions similar to setImmediate. It provides a method called .defer() which can be used to schedule tasks to run in the future. Bluebird's implementation may differ in terms of performance and timing guarantees.
The asap package is a task scheduler that prioritizes tasks in a way that, like setImmediate, they run after the current call stack but with different internal mechanisms. It aims to execute tasks as soon as possible while being faster than setTimeout or setImmediate in some cases.
FAQs
A shim for the setImmediate efficient script yielding API
We found that setimmediate 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
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.