{"_id":"timeout-abort-controller","_rev":"4574150","name":"timeout-abort-controller","description":"An AbortController that aborts after a specified timeout","dist-tags":{"latest":"3.0.0"},"maintainers":[{"name":"jacobheun","email":""}],"time":{"modified":"2026-04-10T15:37:07.000Z","created":"2019-12-10T11:57:41.432Z","3.0.0":"2022-01-12T11:28:16.947Z","2.0.0":"2021-10-05T18:32:31.912Z","1.1.1":"2020-06-09T11:56:11.427Z","1.1.0":"2019-12-19T01:32:45.483Z","1.0.0":"2019-12-10T11:57:41.432Z"},"users":{},"author":{"name":"Jacob Heun"},"repository":{"type":"git","url":"git+https://github.com/jacobheun/timeout-abort-controller.git"},"versions":{"3.0.0":{"name":"timeout-abort-controller","version":"3.0.0","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","prepare":"rimraf dist && tsc --emitDeclarationOnly --declarationDir dist"},"keywords":[],"author":{"name":"Jacob Heun"},"license":"MIT","dependencies":{"retimer":"^3.0.0"},"devDependencies":{"@types/tape":"^4.13.2","delay":"^5.0.0","nyc":"^15.0.1","playwright-test":"^7.1.0","rimraf":"^3.0.2","standard":"^16.0.3","tape":"^5.0.1","typescript":"^4.1.3"},"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","types":"dist/index.d.ts","gitHead":"605ca885d95631124ceaca3016c6c69f9966665e","_id":"timeout-abort-controller@3.0.0","_nodeVersion":"16.10.0","_npmVersion":"7.24.0","dist":{"shasum":"dd57ffca041652c03769904f8d95afd93fb95595","size":2575,"noattachment":false,"key":"/timeout-abort-controller/-/timeout-abort-controller-3.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/timeout-abort-controller/download/timeout-abort-controller-3.0.0.tgz"},"_npmUser":{"name":"jacobheun","email":"jacobheun@gmail.com"},"directories":{},"maintainers":[{"name":"jacobheun","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/timeout-abort-controller_3.0.0_1641986896800_0.5078414958027704"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-01-12T11:28:38.400Z","publish_time":1641986896947,"_cnpm_publish_time":1641986896947},"2.0.0":{"name":"timeout-abort-controller","version":"2.0.0","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","prepare":"rimraf dist && tsc --emitDeclarationOnly --declarationDir dist"},"keywords":[],"author":{"name":"Jacob Heun"},"license":"MIT","dependencies":{"abort-controller":"^3.0.0","native-abort-controller":"^1.0.4","retimer":"^3.0.0"},"devDependencies":{"@types/tape":"^4.13.2","delay":"^5.0.0","nyc":"^15.0.1","playwright-test":"^7.1.0","rimraf":"^3.0.2","standard":"^16.0.3","tape":"^5.0.1","typescript":"^4.1.3"},"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","types":"dist/index.d.ts","gitHead":"91e9ec9c602356bed91f6cb1eaf9071c7d99da61","_id":"timeout-abort-controller@2.0.0","_nodeVersion":"16.10.0","_npmVersion":"7.24.0","dist":{"shasum":"d6a59209132e520413092dd4b4d71eaaf5887feb","size":2597,"noattachment":false,"key":"/timeout-abort-controller/-/timeout-abort-controller-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/timeout-abort-controller/download/timeout-abort-controller-2.0.0.tgz"},"_npmUser":{"name":"jacobheun","email":"jacobheun@gmail.com"},"directories":{},"maintainers":[{"name":"jacobheun","email":""}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/timeout-abort-controller_2.0.0_1633458751594_0.7437365117594299"},"_hasShrinkwrap":false,"publish_time":1633458751912,"_cnpm_publish_time":1633458751912,"_cnpmcore_publish_time":"2021-12-16T13:36:06.782Z"},"1.1.1":{"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":{"shasum":"2c3c3c66f13c783237987673c276cbd7a9762f29","size":2469,"noattachment":false,"key":"/timeout-abort-controller/-/timeout-abort-controller-1.1.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/timeout-abort-controller/download/timeout-abort-controller-1.1.1.tgz"},"maintainers":[{"name":"jacobheun","email":""}],"_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,"publish_time":1591703771427,"_cnpm_publish_time":1591703771427,"_cnpmcore_publish_time":"2021-12-16T13:36:06.992Z"},"1.1.0":{"name":"timeout-abort-controller","version":"1.1.0","description":"An AbortController that aborts after a specified timeout","main":"index.js","scripts":{"test":"npm run lint && nyc --reporter=lcov --reporter=text ava --verbose","lint":"standard"},"keywords":[],"author":{"name":"Jacob Heun"},"license":"MIT","dependencies":{"abort-controller":"^3.0.0","retimer":"^2.0.0"},"devDependencies":{"ava":"^2.4.0","delay":"^4.3.0","nyc":"^14.1.1","standard":"^14.3.1"},"ava":{"babel":false,"compileEnhancements":false,"failWithoutAssertions":false},"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":"9fab367916bda12d08e24250e5614db78d79517f","_id":"timeout-abort-controller@1.1.0","_nodeVersion":"12.13.0","_npmVersion":"6.12.0","dist":{"shasum":"7b7a8b1d5f88199898312d77c7d48ef605dcaf32","size":2250,"noattachment":false,"key":"/timeout-abort-controller/-/timeout-abort-controller-1.1.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/timeout-abort-controller/download/timeout-abort-controller-1.1.0.tgz"},"maintainers":[{"name":"jacobheun","email":""}],"_npmUser":{"name":"jacobheun","email":"jacobheun@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/timeout-abort-controller_1.1.0_1576719165344_0.23539927138789585"},"_hasShrinkwrap":false,"publish_time":1576719165483,"_cnpm_publish_time":1576719165483,"_cnpmcore_publish_time":"2021-12-16T13:36:07.215Z"},"1.0.0":{"name":"timeout-abort-controller","version":"1.0.0","description":"An AbortController that aborts after a specified timeout","main":"index.js","scripts":{"test":"npm run lint && nyc --reporter=lcov --reporter=text ava --verbose","lint":"standard"},"keywords":[],"author":{"name":"Jacob Heun"},"license":"MIT","dependencies":{"abort-controller":"^3.0.0","retimer":"^2.0.0"},"devDependencies":{"ava":"^2.4.0","delay":"^4.3.0","nyc":"^14.1.1","standard":"^14.3.1"},"ava":{"babel":false,"compileEnhancements":false,"failWithoutAssertions":false},"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":"2916b50f4c93cee0f2502abe34638408b2890eea","_id":"timeout-abort-controller@1.0.0","_nodeVersion":"12.13.0","_npmVersion":"6.12.0","dist":{"shasum":"bc39ce4f60eadb499a380b1a867d420f47fb4bff","size":2182,"noattachment":false,"key":"/timeout-abort-controller/-/timeout-abort-controller-1.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/timeout-abort-controller/download/timeout-abort-controller-1.0.0.tgz"},"maintainers":[{"name":"jacobheun","email":""}],"_npmUser":{"name":"jacobheun","email":"jacobheun@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/timeout-abort-controller_1.0.0_1575979061271_0.5207121912907451"},"_hasShrinkwrap":false,"publish_time":1575979061432,"_cnpm_publish_time":1575979061432,"_cnpmcore_publish_time":"2021-12-16T13:36:07.525Z"}},"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","_attachments":{},"homepage":"https://github.com/jacobheun/timeout-abort-controller#readme","bugs":{"url":"https://github.com/jacobheun/timeout-abort-controller/issues"},"license":"MIT"}