@nodesuite/abort
v0.3.32
Published
Native AbortController manager.
Downloads
5
Maintainers
Readme
@nodesuite/abort
Summary
Simplified wrapper for native AbortController
.
Install
# PNPM
pnpm install @nodesuite/abort
# Yarn
yarn install @nodesuite/abort
# NPM
npm install @nodesuite/abort
Example
import { Abort, type AbortManager } from "@nodesuite/abort"
const abort: AbortManager = new Abort()
// Less verbose listeners.
abort.onAbort(() => console.log(`Aborted!`))
// Feeback
const result: boolean | Error = abort.abort()
Native AbortController
Comparison
const abort: AbortController = new AbortController()
// Complex listener defintion.
abort.signal.addEventListener("abort", () => console.log(`Aborted!`), {
once: true
})
// No result feeback...
abort.abort()