{"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":{"integrity":"sha512-xLV+Ms6mDc8UKpBAGGwRkZ137VqS63nGYRnzvI2f1bbv5TWqr4S7ST81870ekn+zlODruVsUexU6GCnErkM7Pw==","shasum":"7b7a8b1d5f88199898312d77c7d48ef605dcaf32","tarball":"http://registry-npm.ywwl.com/timeout-abort-controller/download/timeout-abort-controller-1.1.0.tgz","fileCount":4,"unpackedSize":4946,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJd+tM+CRA9TVsSAnZWagAAZw0P+wWiok53NapM8/Low9pm\nqMwsNFuNQUbzC7kZkHaDUr0Pm5z1SaZBq1de1F97rjrl7xle04LbNiAFX1Oj\nlGMqWctFkjBB+OdEKmcMGLA9d4MF5WLZDvJ9pd21OxLMyDx/Vu3q6iQX+twc\n1hZ9iBmukZf3bWEAq7vDmLGCJo9npYTEzBlgEXVJW4sbAPaR7IUn7t7ygl7A\nW4D6Az967QKF9tBVK5HMr4AkISjtBJP3p1mYXAEocf2SsFYfUIcWZPooUgb/\nr+EzKN2vcxJnoShLaOh8vXty85imAfx5kljDpnk0egep2LVKlvd1Rmt3xjev\n/sQnebXDSr7jUYE+PJE2KEtqJNGubJLshS0zoyGgqinVnRkvW3SY3OuL+SUe\nPS2Wc70YngGsUqu1oApTvpotY3sWzz7W/YOE6gy51vzHIQUADIJqoimtN6X0\nOJMhrREIn7QH6Bl+1QNM93CgFmk5pAwDehgx89mbARakQDlXr5ioF9B+Eemi\nqflwZriS3c+UTLO0kvD4/rbVoeM9//pZsgatnV87Aa1YQryFJomy5n1PulIS\nCRpiTae5iZ/rfRBfd/yOQT3UsXkh5YJL9KcVUubKvkuql3Yn/a7+TCAHYvbp\n3Y7ykd+tvI2IMEH9ebuTJ/hWrZOzNxVUuVTXxUNMEUqjxoLV17uZh6HC26dY\nClia\r\n=h4pH\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGQN8mxK9HMVGFs3elniaUuzjnTFTQAO4xomrQG2dm1TAiEAirazNVxn0eHwhUf2Cfb5tG1wbDFMPgE0lco0tTTC/CU="}],"size":2250,"noattachment":false,"key":"/timeout-abort-controller/-/timeout-abort-controller-1.1.0.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.0_1576719165344_0.23539927138789585"},"_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":1576719165483,"_cnpm_publish_time":1576719165483,"dist-tags":{"latest":"3.0.0"}}