{"name":"any-signal","version":"4.1.1","description":"Combines an array of AbortSignals into a single signal that is aborted when any signal is","license":"Apache-2.0 OR MIT","homepage":"https://github.com/jacobheun/any-signal#readme","repository":{"type":"git","url":"git+https://github.com/jacobheun/any-signal.git"},"bugs":{"url":"https://github.com/jacobheun/any-signal/issues"},"engines":{"node":">=16.0.0","npm":">=7.0.0"},"type":"module","types":"./dist/src/index.d.ts","exports":{".":{"types":"./dist/src/index.d.ts","import":"./dist/src/index.js"}},"eslintConfig":{"extends":"ipfs","parserOptions":{"sourceType":"module"}},"release":{"branches":["master"],"plugins":[["@semantic-release/commit-analyzer",{"preset":"conventionalcommits","releaseRules":[{"breaking":true,"release":"major"},{"revert":true,"release":"patch"},{"type":"feat","release":"minor"},{"type":"fix","release":"patch"},{"type":"docs","release":"patch"},{"type":"test","release":"patch"},{"type":"deps","release":"patch"},{"scope":"no-release","release":false}]}],["@semantic-release/release-notes-generator",{"preset":"conventionalcommits","presetConfig":{"types":[{"type":"feat","section":"Features"},{"type":"fix","section":"Bug Fixes"},{"type":"chore","section":"Trivial Changes"},{"type":"docs","section":"Documentation"},{"type":"deps","section":"Dependencies"},{"type":"test","section":"Tests"}]}}],"@semantic-release/changelog","@semantic-release/npm","@semantic-release/github","@semantic-release/git"]},"scripts":{"clean":"aegir clean","lint":"aegir lint","dep-check":"aegir dep-check","build":"aegir build","test":"aegir test","test:chrome":"aegir test -t browser --cov","test:chrome-webworker":"aegir test -t webworker","test:firefox":"aegir test -t browser -- --browser firefox","test:firefox-webworker":"aegir test -t webworker -- --browser firefox","test:node":"aegir test -t node --cov","test:electron-main":"aegir test -t electron-main","release":"aegir release","docs":"aegir docs"},"devDependencies":{"aegir":"^38.1.8","p-defer":"^4.0.0","wherearewe":"^2.0.1"},"browser":{"node:events":false},"gitHead":"c5182d8aa968a870e0d4bc21e993865cc852df86","_id":"any-signal@4.1.1","_nodeVersion":"18.15.0","_npmVersion":"8.19.4","dist":{"integrity":"sha512-iADenERppdC+A2YKbOXXB2WUeABLaM6qnpZ70kZbPZ1cZMMJ7eF+3CaYm+/PhBizgkzlvssC7QuHS30oOiQYWA==","shasum":"928416c355c66899e6b2a91cad4488f0324bae03","tarball":"http://registry-npm.ywwl.com/any-signal/download/any-signal-4.1.1.tgz","fileCount":10,"unpackedSize":12747,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIEvzgcZJcUk8j794xtgF9uZ/E2IFhl66s2roiU5st/0dAiEAnANna2vNkWfcLUFNukvZTbUNkFntUXkhF5FtyUrlpnM="}],"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJkODm6ACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmoXCA//Q072aImVN6/7zHhobEiw4uik81HjLeNjmyvvPoaZlUyIT1ht\r\nbB9u5B56UzYu/prwiwhAOOiJwxiOgSWxED2mrtYtezuDuAk+SyditZjaND6v\r\nrwddcfMetW6nDfiSZl1goSLv3aALwTQ8NlZHNeTsil4rNxvyH+DlI2r1qnIs\r\nJqM+/hMXDJeeDDzCPdEEbE27WjP81vt+ZOcwVEMXGa+EhgnjHZsJPgm3oQls\r\nkENfZuDkBIE8QjP6upEZL6HDPcUNVJGaDjY42Uw7eP76smYwJ79ntMHX6jv0\r\nJ85aTqDsrLjCnAXjyPWvCFE1UNE2cxuNxCMduza5coAB+gjYdIbXk5sJrxPf\r\nKcWfBKwOqZvZR5hWvIXhBwiuCJPIh2z5dXXJoNAUlIgXxTbtV37n9re4nj3g\r\npzLMYvGInrnM2XnnjPL2C+B81TsObikvS8gIUMlapy4Z4MGqc6q14vSEYRM+\r\nm9gLcdPB3J7br01JH/8KldvyTmwib4g8RfmTW0GaIHGppl223sLq+w/s+jno\r\n6/f1UUdDNbUKxKknGZbw7HoMZJdAJGYGyHfmsZabmHGu+Cqcyr6gvM39rtqi\r\nWrVxSQdXPC6JDoNc2daXzBjJGOW2fPOWNzQ/wdxdkwWsDW7MlHL49nBe4S+G\r\n8U3n3Ts8UyqooXZZOcEQrSY7Yxer2A138E4=\r\n=YHq+\r\n-----END PGP SIGNATURE-----\r\n","size":4044,"noattachment":false,"key":"/any-signal/-/any-signal-4.1.1.tgz"},"_npmUser":{"name":"jacobheun","email":"jacobheun@gmail.com"},"directories":{},"maintainers":[{"name":"jacobheun","email":"jacobheun@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/any-signal_4.1.1_1681406393921_0.2125237653891896"},"_hasShrinkwrap":false,"readme":"# any-signal <!-- omit in toc -->\n\n[![codecov](https://img.shields.io/codecov/c/github/jacobheun/any-signal.svg?style=flat-square)](https://codecov.io/gh/jacobheun/any-signal)\n[![CI](https://img.shields.io/github/actions/workflow/status/jacobheun/any-signal/js-test-and-release.yml?branch=master\\&style=flat-square)](https://github.com/jacobheun/any-signal/actions/workflows/js-test-and-release.yml?query=branch%3Amaster)\n\n> Combines an array of AbortSignals into a single signal that is aborted when any signal is\n\n## Table of contents <!-- omit in toc -->\n\n- [Install](#install)\n  - [Browser `<script>` tag](#browser-script-tag)\n- [Usage](#usage)\n- [API](#api)\n  - [`anySignal(signals)`](#anysignalsignals)\n    - [Parameters](#parameters)\n    - [Returns](#returns)\n  - [`ClearableSignal.clear()`](#clearablesignalclear)\n- [Acknowledgements](#acknowledgements)\n- [API Docs](#api-docs)\n- [License](#license)\n- [Contribution](#contribution)\n\n## Install\n\n```console\n$ npm i any-signal\n```\n\n### Browser `<script>` tag\n\nLoading this module through a script tag will make it's exports available as `AnySignal` in the global namespace.\n\n```html\n<script src=\"https://unpkg.com/any-signal/dist/index.min.js\"></script>\n```\n\n## Usage\n\n```js\nimport { anySignal } from 'any-signal'\n\nconst userController = new AbortController()\nconst timeoutController = new AbortController()\n\nconst combinedSignal = anySignal([userController.signal, timeoutController.signal])\ncombinedSignal.addEventListener('abort', () => console.log('Abort!'))\n\n// Abort after 1 second\nconst timeoutId = setTimeout(() => timeoutController.abort(), 1000)\n\n// The user or the timeout can now abort the action\nawait performSomeAction({ signal: combinedSignal })\nclearTimeout(timeoutId)\n\n// Clear will clean up internal event handlers\ncombinedSignal.clear()\n```\n\n## API\n\n### `anySignal(signals)`\n\n#### Parameters\n\n| Name    | Type                                                                                 | Description                                                         |\n| ------- | ------------------------------------------------------------------------------------ | ------------------------------------------------------------------- |\n| signals | Array<[`AbortSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal)> | The Signals that will be observed and mapped to the returned Signal |\n\n#### Returns\n\n| Type                                                                              | Description                                                                                                                                   |\n| --------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------- |\n| [`ClearableSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) | A Signal that will be aborted as soon as any one of its parent signals are aborted. Extends AbortSignal with the `clear` function for cleanup |\n\nThe returned [`ClearableSignal`](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) will only be aborted once, and as soon as one of its parent signals is aborted.\n\n### `ClearableSignal.clear()`\n\nRemoves all internal event handlers. This **must** be called after abort has been called, or the signals have successfully executed, otherwise there is a risk of leaking event handlers.\n\n## Acknowledgements\n\nThe anySignal function is taken from a [comment by jakearchibald](https://github.com/whatwg/fetch/issues/905#issuecomment-491970649)\n\n## API Docs\n\n- <https://jacobheun.github.io/any-signal>\n\n## License\n\nLicensed under either of\n\n- Apache 2.0, ([LICENSE-APACHE](LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)\n- MIT ([LICENSE-MIT](LICENSE-MIT) / <http://opensource.org/licenses/MIT>)\n\n## Contribution\n\nUnless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.\n","publish_time":1681406394113,"_cnpm_publish_time":1681406394113,"dist-tags":{"latest":"4.2.0"}}