{"name":"timeout-abort-controller","version":"1.1.1","description":"An AbortController that aborts after a specified timeout","main":"index.js","scripts":{"test":"npm run lint && nyc --reporter=lcov --reporter=text tape test.js","test:browser":"npm run test:chrome && npm run test:firefox && npm run test:webkit","test:chrome":"playwright-test test.js --browser chromium --runner tape","test:firefox":"playwright-test test.js --browser firefox --runner tape","test:webkit":"playwright-test test.js --browser webkit --runner tape","lint":"standard"},"keywords":[],"author":{"name":"Jacob Heun"},"license":"MIT","dependencies":{"abort-controller":"^3.0.0","retimer":"^2.0.0"},"devDependencies":{"delay":"^4.3.0","nyc":"^15.0.1","playwright-test":"^0.7.1","standard":"^14.3.1","tape":"^5.0.1"},"repository":{"type":"git","url":"git+https://github.com/jacobheun/timeout-abort-controller.git"},"bugs":{"url":"https://github.com/jacobheun/timeout-abort-controller/issues"},"homepage":"https://github.com/jacobheun/timeout-abort-controller#readme","gitHead":"91af0118f62950b82b9d8de89d4e1e40803968cd","_id":"timeout-abort-controller@1.1.1","_nodeVersion":"12.16.1","_npmVersion":"6.14.2","dist":{"integrity":"sha512-BsF9i3NAJag6T0ZEjki9j654zoafI2X6ayuNd6Tp8+Ul6Tr5s4jo973qFeiWrRSweqvskC+AHDKUmIW4b7pdhQ==","shasum":"2c3c3c66f13c783237987673c276cbd7a9762f29","tarball":"http://registry-npm.ywwl.com/timeout-abort-controller/download/timeout-abort-controller-1.1.1.tgz","fileCount":4,"unpackedSize":5544,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJe33jbCRA9TVsSAnZWagAA9IwP/RqsIQDJx6Iso41/ep++\npGcRhIHOwrKqu8lIaasSfE5zFTNGWWxUISpIpGgviHTXpiQLSJ2E4SKtX0uW\nAdrkh2/gFWP+cCMuNTebp1vIOJeSc6J4B4bSxPsE1NWfd74i8FscnsNdsYRI\n9F4wpkj7rychPAp/ONxcnYCF7vh8Vj/aO0n1x7ufQ3ZDH5+dfBKd1m7b7K2+\nanAjAZjxeWGWAC3nXUxhTNrgmwLRa64PiKvFkDAB5ow/1YvEGnJmL4qlTfvx\n2Uc4KoaoZfgtnmBLP+Wn5xKtXtqVIrDUFzKyFnO1QlFu77oGuBS5jubjWTaB\n4l5gI+bHvV5fYNzElV4FAnFj5ySBiEAwd/TG8TpO8FrW1gupNJ6fiJlSnxft\nrv+ikVIsQ/XmTf0y4K4Q8d4AMYMhOfkL2haYHS/PYvp94TYC9OBeKjJGBcim\nOlvMcVDAzBDQl+VGj//CmXBWF5FKXIc4ZnP4ticv8wLWmmvzqof4aRuXMOt6\nZKlXW8z/K3iKcytDkdl5aJ++2GWzzixeRzL1Heyxjo9ETX9hFrHAPo0Jc2Vb\nHBjbYp9mZUmN2Pk9pWYHbzS23nxPp/J6Ola1J3jHn0OW8BBElKVi3A71qPTc\nswXDYVW2tRT7a1jkn5HmVELQiAqQ1gDL+rO8eP3OSYt/RyO5qQh1q8OXK2xL\nMEAf\r\n=O2Xv\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCICRgFleTa5JQlgVTLUmcesbTYmhgOiEs5WeU8jG+lmjtAiEAuW/+GkbQjrV4TfPUC+i3DGCvfWYOaojlh6PZufp71Xk="}],"size":2469,"noattachment":false,"key":"/timeout-abort-controller/-/timeout-abort-controller-1.1.1.tgz"},"maintainers":[{"name":"jacobheun","email":"jacobheun@gmail.com"}],"_npmUser":{"name":"jacobheun","email":"jacobheun@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/timeout-abort-controller_1.1.1_1591703771262_0.07418187832097134"},"_hasShrinkwrap":false,"readme":"# timeout-abort-controller\n\n[![Build Status](https://travis-ci.com/jacobheun/timeout-abort-controller.svg?branch=master)](https://travis-ci.com/jacobheun/timeout-abort-controller) [![dependencies Status](https://david-dm.org/jacobheun/timeout-abort-controller/status.svg)](https://david-dm.org/jacobheun/timeout-abort-controller) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)\n\n> An AbortController that aborts after a specified timeout.\n\n`timeout-abort-controller` uses [`retimer`](https://github.com/mcollina/retimer) internally to help reduce the impact of having numerous timers running.\n\n## Install\n\n```\nnpm install timeout-abort-controller\n```\n\n## Usage\n\n```js\nconst { AbortController } = require('native-abort-controller')\nconst { TimeoutController } = require('timeout-abort-controller')\nconst anySignal = require('any-signal')\n\nconst userController = new AbortController()\n// Aborts after 1 second\nconst timeoutController = new TimeoutController(1000)\n\nconst combinedSignal = anySignal([userController.signal, timeoutController.signal])\ncombinedSignal.addEventListener('abort', () => console.log('Abort!'))\n\n// The user or the timeout can now abort the action\nawait performSomeAction({ signal: combinedSignal })\ntimeoutController.clear()\n```\n\n## API\n\n### `new TimeoutController(ms)`\n\nCreates an [`AbortController`](https://developer.mozilla.org/en-US/docs/Web/API/AbortController) compliant `TimeoutController`.\n\n#### Parameters\n\n| Name | Type | Description |\n|------|------|-------------|\n| ms | number | The time in milliseconds for when the TimeoutController should abort |\n\n### `timeoutController.clear()`\n\nClears the internal timer.\n\n### `timeoutController.abort()`\n\nAborts the controller and clears the internal timeout.\n\n### `timeoutController.reset()`\n\nClears the timer and sets the internal timeout to occur after the `ms` timeout it was created with.\n\n## Related\n\n- [`abort-controller`](https://github.com/mysticatea/abort-controller)\n- [`native-abort-controller`](https://github.com/achingbrain/native-abort-controller)\n- [`any-signal`](https://github.com/jacobheun/any-signal) Combines an array of AbortSignals into a single signal.\n\n## LICENSE\n\n[MIT](LICENSE) © Jacob Heun\n","publish_time":1591703771427,"_cnpm_publish_time":1591703771427,"dist-tags":{"latest":"3.0.0"}}