{"_id":"atomic-sleep","_rev":"1-efc5f44cdb4125909bb27f1ddb4e0380","name":"atomic-sleep","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"atomic-sleep","version":"1.0.0","description":"Zero CPU overhead, zero dependency, true event-loop blocking sleep","main":"index.js","scripts":{"test":"tap -R classic- -j1 test","lint":"standard","ci":"npm run lint && npm test"},"keywords":["sleep","pause","wait","performance","atomics"],"engines":{"node":">=8.0.0"},"author":{"name":"David Mark Clements","url":"@davidmarkclem"},"license":"MIT","devDependencies":{"standard":"^14.3.1","tap":"^14.10.6","tape":"^4.13.2"},"dependencies":{},"repository":{"type":"git","url":"git+https://github.com/davidmarkclements/atomic-sleep.git"},"bugs":{"url":"https://github.com/davidmarkclements/atomic-sleep/issues"},"homepage":"https://github.com/davidmarkclements/atomic-sleep#readme","gitHead":"b8149d3ca276c84a54fa8fa1478f9cc79aabc15a","_id":"atomic-sleep@1.0.0","_nodeVersion":"12.16.1","_npmVersion":"6.13.4","dist":{"integrity":"sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ==","shasum":"eb85b77a601fc932cfe432c5acd364a9e2c9075b","tarball":"https://registry.npmjs.org/atomic-sleep/-/atomic-sleep-1.0.0.tgz","fileCount":6,"unpackedSize":6571,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeZpFBCRA9TVsSAnZWagAAijMP/2N3Zib59qdGmX8gI0m2\nqHPUxP9dR0nbWAIgpYs9ZsUF7/D2s9tmw7xBZUHolIzcPqqu3w1PpAm19352\nsgqFf0g7PiWNm+vj93Kxb3toupl6LlhDh3/HoqiVgw0Ux7XUttFwAPMI+iKF\nitCYUC7QGUlCLzHf2aefOoViZznq/MCXBzRTW8kZermbVppMAsfW9VpNpLy3\nI02SE7ypDt+PARjU1/4GDJy8eiigfTMTdKTkHaXHLcNxWChCZwqAyfyx/tiX\n7fSxmQjjjW2DYvE3MFucQzNjTcMc3bib8DsaYXmAnNYNO5QSvuBTgDDU+42S\naJTZ2UxJq+F4pMGXqLOZZJLbvycO704yolFZUj2oqRfa9zt7kzTo9woe4YTM\n4cTjW+aGDkznzOpgaOTzW0kxWHnbAbmRlP1i8HdS89d6ABmClHF7ZCLFk2d9\nFwBEXXRWNhQiuSET+n6kVYY+6wLiQIj+4VwZOimjjXA7kF0V3lHoBb3R7/qr\nfutDWq4Wb2GxTXgxPhnC4RcwR7vR2rH0BA3+zrV6RgWeXQZNOdtu3gKpaISP\nyoFYvOXznDFXYjuwUvhx3aP1W9b0ZCec7JSn1YlnlakEI9WFqLM/aJXuqiau\n7mmzx1B9rXgXbhhhy5rmXI93YHLEL9T2sjjKnKf8NdYcHOoRoMmErs2r8OSE\nHoSl\r\n=ZnxI\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIDIAWDsJ/viqpY3InPbGAVn9/N2Xh4eLurTIQCm3i1d8AiBR5pFuCtc7JZg8OddJaTWDJ0tMHTIiQtg/UtxOlkkSAw=="}]},"maintainers":[{"name":"davidmarkclements","email":"huperekchuno@googlemail.com"}],"_npmUser":{"name":"davidmarkclements","email":"huperekchuno@googlemail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/atomic-sleep_1.0.0_1583780161396_0.3874882191086746"},"_hasShrinkwrap":false}},"time":{"created":"2020-03-09T18:56:01.396Z","1.0.0":"2020-03-09T18:56:01.508Z","modified":"2022-04-11T15:42:43.973Z"},"maintainers":[{"name":"davidmarkclements","email":"huperekchuno@googlemail.com"}],"description":"Zero CPU overhead, zero dependency, true event-loop blocking sleep","homepage":"https://github.com/davidmarkclements/atomic-sleep#readme","keywords":["sleep","pause","wait","performance","atomics"],"repository":{"type":"git","url":"git+https://github.com/davidmarkclements/atomic-sleep.git"},"author":{"name":"David Mark Clements","url":"@davidmarkclem"},"bugs":{"url":"https://github.com/davidmarkclements/atomic-sleep/issues"},"license":"MIT","readme":"

Welcome to atomic-sleep ⏱️

\n

\n \"Version\"\n \n \"License:\n \n \n \"Twitter:\n \n

\n\n> Zero CPU overhead, zero dependency, true event-loop blocking sleep\n\n## Usage\n\n```js\nconst sleep = require('atomic-sleep')\n\nconsole.time('sleep')\nsetTimeout(() => { console.timeEnd('sleep') }, 100) \nsleep(1000)\n```\n\nThe `console.time` will report a time of just over 1000ms despite the `setTimeout`\nbeing 100ms. This is because the event loop is paused for 1000ms and the setTimeout\nfires immediately after the event loop is no longer blocked (as more than 100ms have passed).\n\n## Install\n\n```sh\nnpm install\n```\n\n## Run tests\n\n```sh\nnpm test\n```\n\n## Support\n\nNode and Browser versions that support both `SharedArrayBuffer` and `Atomics` will have (virtually) zero CPU overhead sleep. \n\nFor Node, Atomic Sleep can provide zero CPU overhead sleep from Node 8 and up.\n\nFor browser support see https://caniuse.com/#feat=sharedarraybuffer and https://caniuse.com/#feat=mdn-javascript_builtins_atomics.\n\n\nFor older Node versions and olders browsers we fall back to blocking the event loop in a way that will cause a CPU spike. \n\n\n\n## Author\n\n👤 **David Mark Clements (@davidmarkclem)**\n\n* Twitter: [@davidmarkclem](https://twitter.com/davidmarkclem)\n* Github: [@davidmarkclements](https://github.com/davidmarkclements)\n","readmeFilename":"readme.md"}