Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
any-signal
Advanced tools
Combines an array of AbortSignals into a single signal that is aborted when any signal is
Combines an array of AbortSignals into a single signal that is aborted when any signal is
$ npm i any-signal
<script>
tagLoading this module through a script tag will make it's exports available as AnySignal
in the global namespace.
<script src="https://unpkg.com/any-signal/dist/index.min.js"></script>
import { anySignal } from 'any-signal'
const userController = new AbortController()
const timeoutController = new AbortController()
const combinedSignal = anySignal([userController.signal, timeoutController.signal])
combinedSignal.addEventListener('abort', () => console.log('Abort!'))
// Abort after 1 second
const timeoutId = setTimeout(() => timeoutController.abort(), 1000)
// The user or the timeout can now abort the action
await performSomeAction({ signal: combinedSignal })
clearTimeout(timeoutId)
// Clear will clean up internal event handlers
combinedSignal.clear()
anySignal(signals)
Name | Type | Description |
---|---|---|
signals | Array<AbortSignal > | The Signals that will be observed and mapped to the returned Signal |
Type | Description |
---|---|
ClearableSignal | 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 |
The returned ClearableSignal
will only be aborted once, and as soon as one of its parent signals is aborted.
ClearableSignal.clear()
Removes 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.
The anySignal function is taken from a comment by jakearchibald
Licensed under either of
Unless 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.
FAQs
Combines an array of AbortSignals into a single signal that is aborted when any signal is
The npm package any-signal receives a total of 101,868 weekly downloads. As such, any-signal popularity was classified as popular.
We found that any-signal demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.