{"name":"any-signal","version":"4.1.2","license":"Apache-2.0 OR MIT","_id":"any-signal@4.1.2","maintainers":[{"name":"jacobheun","email":"jacobheun@gmail.com"}],"homepage":"https://github.com/jacobheun/any-signal#readme","bugs":{"url":"https://github.com/jacobheun/any-signal/issues"},"dist":{"shasum":"df1538591ce233b52f125792f95b84c6f2e21527","tarball":"http://registry-npm.ywwl.com/any-signal/download/any-signal-4.1.2.tgz","fileCount":10,"integrity":"sha512-bt4O0+GFGFdgtsHw4m/sBSOvunsxZYIw/iFtBTrCsywNwP6sgvKCvxGUMzjZqiFaDxg9MlO0V0Td7cee0OcEbw==","signatures":[{"sig":"MEUCIAywlNPm9mYiY9UVPfATEV/pHMY0bq3vPMqXUWTkNDfXAiEAt2UTRhr8y20cJ1VHmqkaeVTrMN2TsCraFB7iB+Qt52Q=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/any-signal@4.1.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":17907,"size":4651,"noattachment":false,"key":"/any-signal/-/any-signal-4.1.2.tgz"},"type":"module","types":"./dist/src/index.d.ts","browser":{"node:events":false},"engines":{"npm":">=7.0.0","node":">=16.0.0"},"exports":{".":{"types":"./dist/src/index.d.ts","import":"./dist/src/index.js"}},"gitHead":"c54eca214fc4fb1a8d5d00c1c45373dee9496153","release":{"plugins":[["@semantic-release/commit-analyzer",{"preset":"conventionalcommits","releaseRules":[{"release":"major","breaking":true},{"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",{"assets":["CHANGELOG.md","package.json"]}]],"branches":["master"]},"scripts":{"docs":"aegir docs","lint":"aegir lint","test":"aegir test","build":"aegir build","clean":"aegir clean","release":"aegir release","dep-check":"aegir dep-check","test:node":"aegir test -t node --cov","test:chrome":"aegir test -t browser --cov","test:firefox":"aegir test -t browser -- --browser firefox","test:electron-main":"aegir test -t electron-main","test:chrome-webworker":"aegir test -t webworker","test:firefox-webworker":"aegir test -t webworker -- --browser firefox"},"_npmUser":{"name":"jacobheun","email":"jacobheun@gmail.com"},"repository":{"url":"git+https://github.com/jacobheun/any-signal.git","type":"git"},"_npmVersion":"10.9.4","description":"Combines an array of AbortSignals into a single signal that is aborted when any signal is","directories":{},"_nodeVersion":"24.11.1","publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"aegir":"^47.0.25","p-defer":"^4.0.0","wherearewe":"^2.0.1"},"_npmOperationalInternal":{"tmp":"tmp/any-signal_4.1.2_1765825330571_0.8314148807646513","host":"s3://npm-registry-packages-npm-production"},"readme":"# any-signal\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# About\n\n<!--\n\n!IMPORTANT!\n\nEverything in this README between \"# About\" and \"# Install\" is automatically\ngenerated and will be overwritten the next time the doc generator is run.\n\nTo make changes to this section, please update the @packageDocumentation section\nof src/index.js or src/index.ts\n\nTo experiment with formatting, please run \"npm run docs\" from the root of this\nrepo and examine the changes made.\n\n-->\n\nSimilar to [AbortSignal.any](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal/any_static)\nexcept the returned promise has a `.clear` method that removes all event\nlisteners added to passed signals preventing memory leaks.\n\nAt the time of writing at least, `AbortSignal.any` leaks memory in Node.js\nand Deno environments:\n\n- <https://github.com/nodejs/node/issues/54614>\n- <https://github.com/denoland/deno/issues/24842>\n\n## Example\n\n```js\nimport { anySignal } from 'any-signal'\n\nconst userController = new AbortController()\n\n// Abort after 1 second\nconst timeoutSignal = AbortSignal.timeout(1000)\n\nconst combinedSignal = anySignal([userController.signal, timeoutSignal])\ncombinedSignal.addEventListener('abort', () => console.log('Abort!'))\n\ntry {\n  // The user or the timeout can now abort the action\n  await performSomeAction({ signal: combinedSignal })\n} finally {\n  // Clear will clean up internal event handlers\n  combinedSignal.clear()\n}\n```\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 its 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## 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](https://github.com/jacobheun/any-signal/LICENSE-APACHE) / <http://www.apache.org/licenses/LICENSE-2.0>)\n- MIT ([LICENSE-MIT](https://github.com/jacobheun/any-signal/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":1765825330729,"_cnpm_publish_time":1765825330729,"dist-tags":{"latest":"4.2.0"}}