
Security News
Software Engineering Daily Podcast: Feross on AI, Open Source, and Supply Chain Risk
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.
abort-signal
Advanced tools
A utility library for working with AbortSignal in JavaScript and TypeScript.
abort-signal is a utility library for working with AbortSignal in JavaScript and TypeScript. It provides a modern, intuitive API to simplify common cancellation and timeout patterns.
pnpm install abort-signal
npm
npm install abort-signal
yarn
yarn add abort-signal
The most common use case: aborting an operation if it takes too long.
try {
// Request will fail if it takes longer than 3 seconds.
const response = await fetch(url, { signal: Abort.timeout(3000) });
} catch (error) {
if (error instanceof TimeoutError) {
console.log('Request timed out!');
}
}
Abort an operation from one of several sources, like a timeout OR a user click.
const userClickSignal = Abort.fromEvent(cancelButton, 'click');
const timeoutSignal = Abort.timeout(10000);
// Aborts on user click OR timeout, whichever comes first.
const combinedSignal = Abort.any([userClickSignal, timeoutSignal]);
await longRunningOperation({ signal: combinedSignal });
Bridge the DOM/event world with the cancellation world.
// Signal will abort as soon as the user navigates away or closes the tab.
const signal = Abort.fromEvent(window, 'unload');
await saveDraftToServer({ signal });
For detailed API documentation on all methods, please see the API docs.
Want to contribute? Awesome! To show your support is to star the project, or to raise issues on GitHub.
Thanks again for your support, it is much appreciated! 🙏
MIT © Shahrad Elahi and contributors.
FAQs
A utility library for working with AbortSignal in JavaScript and TypeScript.
We found that abort-signal demonstrated a healthy version release cadence and project activity because the last version was released less than 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
Socket CEO Feross Aboukhadijeh joins Software Engineering Daily to discuss modern software supply chain attacks and rising AI-driven security risks.

Security News
GitHub has revoked npm classic tokens for publishing; maintainers must migrate, but OpenJS warns OIDC trusted publishing still has risky gaps for critical projects.

Security News
Rust’s crates.io team is advancing an RFC to add a Security tab that surfaces RustSec vulnerability and unsoundness advisories directly on crate pages.