@zkochan/pnpm
Version:
Fast, disk space efficient package manager
133 lines (132 loc) • 7.16 kB
JSON
{
"_args": [
[
{
"raw": "delay@4.0.0",
"scope": null,
"escapedName": "delay",
"name": "delay",
"rawSpec": "4.0.0",
"spec": "4.0.0",
"type": "version"
},
"/home/zkochan/src/pnpm/packages/pnpm"
]
],
"_from": "delay@4.0.0",
"_hasShrinkwrap": false,
"_id": "delay@4.0.0",
"_location": "/delay",
"_nodeVersion": "8.11.4",
"_npmOperationalInternal": {
"host": "s3://npm-registry-packages",
"tmp": "tmp/delay_4.0.0_1535947266745_0.8170597622684077"
},
"_npmUser": {
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
},
"_npmVersion": "5.6.0",
"_phantomChildren": {},
"_requested": {
"raw": "delay@4.0.0",
"scope": null,
"escapedName": "delay",
"name": "delay",
"rawSpec": "4.0.0",
"spec": "4.0.0",
"type": "version"
},
"_requiredBy": [
"/"
],
"_resolved": "https://registry.npmjs.org/delay/-/delay-4.0.0.tgz",
"_shasum": "a890c37829b5cd39ffe1be7453849f5a8169d5de",
"_shrinkwrap": null,
"_spec": "delay@4.0.0",
"_where": "/home/zkochan/src/pnpm/packages/pnpm",
"author": {
"name": "Sindre Sorhus",
"email": "sindresorhus@gmail.com",
"url": "sindresorhus.com"
},
"bugs": {
"url": "https://github.com/sindresorhus/delay/issues"
},
"dependencies": {},
"description": "Delay a promise a specified amount of time",
"devDependencies": {
"abort-controller": "^1.0.2",
"ava": "1.0.0-beta.8",
"currently-unhandled": "^0.4.1",
"in-range": "^1.0.0",
"time-span": "^2.0.0",
"tsd-check": "^0.1.0",
"xo": "*"
},
"directories": {},
"dist": {
"integrity": "sha512-M5om7qDqgWbLauRFlGgcfVEmQpHJMs24NL0I/dqahsESNdJrRiLuAodrsC1vV1YL5+yC2kh6k8vANWNKvYMd6A==",
"shasum": "a890c37829b5cd39ffe1be7453849f5a8169d5de",
"tarball": "https://registry.npmjs.org/delay/-/delay-4.0.0.tgz",
"fileCount": 5,
"unpackedSize": 7694,
"npm-signature": "-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJbjLIDCRA9TVsSAnZWagAApQQP/1tJo+Ew9x+X07iZjVq2\ndAopV191L0nCVpVVi/Nda+PiGCjBt/J+cpaH6g5n5QmEg4BqHAjFAtA+VTiX\nr+R1h86QxnBSiwosIkqI6cwJdolfgHazREWayQKiLXcFos2EJfLtLNxup+HI\nS7h9gmDdW6Oy1Yb9eQso2hJlaBUv+cOuNKHRmLsy5nJ+xcbkU+ImDvJvNmhw\nlHDJNLxPJ8fNnqudoDdEEWu7KRzl3H9yPTsShiN5aMnPGVRJvpzGnRQXbc83\nXaiOPWLEvg0vRtUSTVaFTIfSbwwwY2d0f+679KkY7dsyIp8IkmrBKbxrRuZn\nS+dB+gc/xpWKKulucWrzgNxsIB8tiCatFmTl1Ht/Jx6P31s+j1XHq+Wferg3\nNIEOLQqJSE8MhoTEaJSfhPzwfDiDXGUDPunCEgKrcOVf7wIVH1iEBAZiIe7s\nuNHZcCdYmniZD8eZtUYcwJp8PoOAjphcCQcXvgvIhxwi1ou3zWMcWaut3PRZ\nRt7NP8Y1Y6yZbXDrGXzlnzLEDXt9srNm3LDy1sBgy/Iago1FxxYj4KPUwbMC\n2TdbnD+iMLNyhoGx0WArQ8viyB89ZBnCA97xOgoJ7C9FkQjw08Iz1Z6IAL2G\n7cp+TtFzvawcfAFGyk5jgUkUqigcb+2lnCNmoejG1vpZR67ffowdlwaM2128\n5AUK\r\n=Pdtl\r\n-----END PGP SIGNATURE-----\r\n"
},
"engines": {
"node": ">=6"
},
"files": [
"index.js",
"index.d.ts"
],
"gitHead": "31e7f33c47ebd3b93aa27b2dd9ba8736d22eb9fa",
"homepage": "https://github.com/sindresorhus/delay#readme",
"keywords": [
"promise",
"resolve",
"delay",
"defer",
"wait",
"stall",
"timeout",
"settimeout",
"event",
"loop",
"next",
"tick",
"delay",
"async",
"await",
"promises",
"bluebird"
],
"license": "MIT",
"maintainers": [
{
"name": "jamestalmage",
"email": "james@talmage.io"
},
{
"name": "sindresorhus",
"email": "sindresorhus@gmail.com"
}
],
"name": "delay",
"optionalDependencies": {},
"readme": "# delay [](https://travis-ci.org/sindresorhus/delay)\n\n> Delay a promise a specified amount of time\n\n\n## Install\n\n```\n$ npm install delay\n```\n\n\n## Usage\n\n```js\nconst delay = require('delay');\n\n(async () => {\n\tbar();\n\n\tawait delay(100);\n\n\t// Executed 100 milliseconds later\n\tbaz();\n})();\n```\n\n\n## API\n\n### delay(milliseconds, [options])\n\nCreate a promise which resolves after the specified `milliseconds`.\n\n### delay.reject(milliseconds, [options])\n\nCreate a promise which rejects after the specified `milliseconds`.\n\n#### milliseconds\n\nType: `number`\n\nMilliseconds to delay the promise.\n\n#### options\n\nType: `Object`\n\n##### value\n\nType: `any`\n\nOptional value to resolve or reject in the returned promise.\n\n##### signal\n\nType: [`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal)\n\nThe returned promise will be rejected with an AbortError if the signal is aborted. AbortSignal is available in all modern browsers and there is a [ponyfill for Node.js](https://github.com/mysticatea/abort-controller).\n\n### delayPromise.clear()\n\nClears the delay and settles the promise.\n\n\n## Advanced usage\n\nPassing a value:\n\n```js\nconst delay = require('delay');\n\n(async() => {\n\tconst result = await delay(100, {value: '🦄'});\n\n\t// Executed after 100 milliseconds\n\tconsole.log(result);\n\t//=> '🦄'\n})();\n```\n\nUsing `delay.reject()`, which optionally accepts a value and rejects it `ms` later:\n\n```js\nconst delay = require('delay');\n\n(async () => {\n\ttry {\n\t\tawait delay.reject(100, {value: new Error('🦄')});\n\n\t\tconsole.log('This is never executed');\n\t} catch (error) {\n\t\t// 100 milliseconds later\n\t\tconsole.log(error);\n\t\t//=> [Error: 🦄]\n\t}\n})();\n```\n\nYou can settle the delay early by calling `.clear()`:\n\n```js\nconst delay = require('delay');\n\n(async () => {\n\tconst delayedPromise = delay(1000, {value: 'Done'});\n\n\tsetTimeout(() => {\n\t\tdelayedPromise.clear();\n\t}, 500);\n\n\t// 500 milliseconds later\n\tconsole.log(await delayedPromise);\n\t//=> 'Done'\n})();\n```\n\nYou can abort the delay with an AbortSignal:\n\n```js\nconst delay = require('delay');\n\n(async () => {\n\tconst abortController = new AbortController();\n\n\tsetTimeout(() => {\n\t\tabortController.abort();\n\t}, 500);\n\n\ttry {\n\t\tawait delay(1000, {signal: abortController.signal});\n\t} catch (error) {\n\t\t// 500 milliseconds later\n\t\tconsole.log(error.name)\n\t\t//=> 'AbortError'\n\t}\n})();\n```\n\n\n## Related\n\n- [delay-cli](https://github.com/sindresorhus/delay-cli) - CLI for this module\n- [p-cancelable](https://github.com/sindresorhus/p-cancelable) - Create a promise that can be canceled\n- [p-min-delay](https://github.com/sindresorhus/p-min-delay) - Delay a promise a minimum amount of time\n- [p-immediate](https://github.com/sindresorhus/p-immediate) - Returns a promise resolved in the next event loop - think `setImmediate()`\n- [p-timeout](https://github.com/sindresorhus/p-timeout) - Timeout a promise after a specified amount of time\n- [More…](https://github.com/sindresorhus/promise-fun)\n\n\n## License\n\nMIT © [Sindre Sorhus](https://sindresorhus.com)\n",
"readmeFilename": "readme.md",
"repository": {
"type": "git",
"url": "git+https://github.com/sindresorhus/delay.git"
},
"scripts": {
"test": "xo && ava && tsd-check"
},
"version": "4.0.0",
"xo": {
"ignores": [
"*.ts"
]
}
}