@nodesuite/abort
TypeScript icon, indicating that this package has built-in type declarations

0.3.32 • Public • Published

nodesuite

@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()

Package Sidebar

Install

npm i @nodesuite/abort

Weekly Downloads

12

Version

0.3.32

License

ISC

Unpacked Size

140 kB

Total Files

22

Last publish

Collaborators

  • insidium