![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
atomic-sleep
Advanced tools
Zero CPU overhead, zero dependency, true event-loop blocking sleep
const sleep = require('atomic-sleep')
console.time('sleep')
setTimeout(() => { console.timeEnd('sleep') }, 100)
sleep(1000)
The console.time
will report a time of just over 1000ms despite the setTimeout
being 100ms. This is because the event loop is paused for 1000ms and the setTimeout
fires immediately after the event loop is no longer blocked (as more than 100ms have passed).
npm install
npm test
Node and Browser versions that support both SharedArrayBuffer
and Atomics
will have (virtually) zero CPU overhead sleep.
For Node, Atomic Sleep can provide zero CPU overhead sleep from Node 8 and up.
For browser support see https://caniuse.com/#feat=sharedarraybuffer and https://caniuse.com/#feat=mdn-javascript_builtins_atomics.
For older Node versions and olders browsers we fall back to blocking the event loop in a way that will cause a CPU spike.
👤 David Mark Clements (@davidmarkclem)
FAQs
Zero CPU overhead, zero dependency, true event-loop blocking sleep
We found that atomic-sleep 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
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.