{"_id":"@awaitbox/sleep","_rev":"3-b6555a2507f93dbbee1a904149e8ddeb","name":"@awaitbox/sleep","description":"@awaitbox/sleep ========================","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.0":{"name":"@awaitbox/sleep","version":"1.0.0","main":"src/index.js","esnext":"src/index.js","module":"src/index.js","homepage":"https://github.com/awaitbox/sleep","repository":{"type":"git","url":"git+ssh://git@github.com/awaitbox/sleep.git"},"bugs":{"url":"https://github.com/awaitbox/sleep/issues"},"keywords":["async","async-functions","async-await","await","web-development","webdev","timer","sleep"],"gitHead":"78743a7bfaac5cc97395d9737288f22e8ba0e91e","description":"@awaitbox/sleep ========================","_id":"@awaitbox/sleep@1.0.0","_npmVersion":"5.6.0","_nodeVersion":"8.5.0","_npmUser":{"name":"trusktr","email":"joe@trusktr.io"},"dist":{"integrity":"sha512-IVA8vb064iqwspigjpnBAWBWXCrj66qMteh8wYOCvBP9MkwnfXIEn+OMV6YNAgkB9j1gvt3Ku3YLpz2PMR/sHA==","shasum":"5abc52aa047c30fcb1dcaf3a751862938080afb4","tarball":"https://registry.npmjs.org/@awaitbox/sleep/-/sleep-1.0.0.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC7+fcLNxdxWGHrsfh0rPPfVIHpvOXvUMsMHsH10wokUAIgehvqV4azwvzEsKOLFZ+Uves1e5Ch5Hn1AC3Q5mQkmh8="}]},"maintainers":[{"name":"trusktr","email":"joe@trusktr.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sleep-1.0.0.tgz_1515195162568_0.6656311573460698"}},"1.0.1":{"name":"@awaitbox/sleep","version":"1.0.1","main":"src/index.js","esnext":"src/index.js","module":"src/index.js","homepage":"https://github.com/awaitbox/sleep","repository":{"type":"git","url":"git+ssh://git@github.com/awaitbox/sleep.git"},"bugs":{"url":"https://github.com/awaitbox/sleep/issues"},"keywords":["async","async-functions","async-await","await","web-development","webdev","timer","sleep"],"gitHead":"56fd90c3b943e0669a828210cc3a5636b3f54c4d","description":"@awaitbox/sleep ========================","_id":"@awaitbox/sleep@1.0.1","_npmVersion":"5.6.0","_nodeVersion":"8.5.0","_npmUser":{"name":"trusktr","email":"joe@trusktr.io"},"dist":{"integrity":"sha512-U/5zx9gqOhQN7RraCL9XSJ8fdYuklTvE63o84u8fWLgrtZnMAO9XAT04b4/BXOPyhsDgRpF6mF1gXwlR0HTfAg==","shasum":"a306637c300ab63c68cda6905c4bd548833b9005","tarball":"https://registry.npmjs.org/@awaitbox/sleep/-/sleep-1.0.1.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDFdbKM59PW2QWrgv7DH3m0fgFccxbPOTc18t6VqI7sxAIhAP5NXSFBjz9dNGaopJVjPGCfEVI9SYPvV9nr/iMuIWDo"}]},"maintainers":[{"name":"trusktr","email":"joe@trusktr.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sleep-1.0.1.tgz_1515204972435_0.5114759809803218"}},"1.0.2":{"name":"@awaitbox/sleep","version":"1.0.2","main":"src/index.js","esnext":"src/index.js","module":"src/index.js","homepage":"https://github.com/awaitbox/sleep","repository":{"type":"git","url":"git+ssh://git@github.com/awaitbox/sleep.git"},"bugs":{"url":"https://github.com/awaitbox/sleep/issues"},"keywords":["async","async-functions","async-await","await","web-development","webdev","timer","sleep"],"gitHead":"5d58c413bc25dd1b89a30357e7565beb7e607c2f","description":"@awaitbox/sleep ========================","_id":"@awaitbox/sleep@1.0.2","_npmVersion":"5.6.0","_nodeVersion":"8.5.0","_npmUser":{"name":"trusktr","email":"joe@trusktr.io"},"dist":{"integrity":"sha512-nQAfo5dS97HD2dowE1uNozm6orr9Y0mKubbZUHqkqItN2sKGqpxchEzNlctcD395jN6mtnyi18FA7Op4jJsWNw==","shasum":"8dd525fb8de3d3bacd402fab226707e6b6b006c0","tarball":"https://registry.npmjs.org/@awaitbox/sleep/-/sleep-1.0.2.tgz","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAsPZISR0Nw97Br+H7MmaA41ByMhiwfa48mn/7YKdYD5AiAkPoeWUstpSEAcImRwaWyw72gXox8RvUndkdhb9Wc1Mw=="}]},"maintainers":[{"name":"trusktr","email":"joe@trusktr.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/sleep-1.0.2.tgz_1515302510591_0.8327250138390809"}}},"readme":"\n@awaitbox/sleep\n========================\n\nAwait for a certain amount of time.\n\n#### `npm i @awaitbox/sleep --save`\n\nThe `sleep` async function returns a promise that will resolve after the\nspecified amount of time. This is a convenient alternative for `setTimeout`.\nThis is inspired from `sleep(...)` in the C language, except that time is\nspecified in milliseconds rather than seconds.\n\nYou can use it in async functions:\n\n```js\nimport sleep from '@awaitbox/sleep'\n\nasync function main() {\n  await sleep( 1000 )\n  console.log( 'I fell asleep for a second!' )\n}\n\nmain()\n```\n\nYou can of course use it as a Promise:\n\n```js\nimport sleep from '@awaitbox/sleep'\n\nsleep( 1000 )\n  .then( data => console.log( 'I took a 1-second nap!' ) )\n```\n\nChain values will pass through if you use it in a Promise chain like follows:\n\n```js\nimport sleep from '@awaitbox/sleep'\n\nfetch( ... )\n  .then( ... )\n  .then( sleep.bind( null, 1000 ) ) // passes data through after 1 second\n  .then( data => console.log( 'use data for the awesome!', data ) )\n```\n\nNote\n----\n\nThis is written in ES2016+ JavaScript. To use this in pre-ES2016 environments,\nyou'll need to run this through a transpiler like [Babel](http://babeljs.io)\n(and I recommend using the\n[fast-async](https://github.com/MatAtBread/fast-async) plugin to get the best\nresults). See some tips here on wiring it up with\n[Webpack](https://webpack.js.org): http://2ality.com/2017/06/pkg-esnext.html.\n","maintainers":[{"name":"trusktr","email":"joe@trusktr.io"}],"time":{"modified":"2022-04-04T16:49:17.789Z","created":"2018-01-05T23:32:43.005Z","1.0.0":"2018-01-05T23:32:43.005Z","1.0.1":"2018-01-06T02:16:12.629Z","1.0.2":"2018-01-07T05:21:50.703Z"},"homepage":"https://github.com/awaitbox/sleep","keywords":["async","async-functions","async-await","await","web-development","webdev","timer","sleep"],"repository":{"type":"git","url":"git+ssh://git@github.com/awaitbox/sleep.git"},"bugs":{"url":"https://github.com/awaitbox/sleep/issues"},"readmeFilename":"README.md"}