npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@abortor/core

v0.1.4

Published

Hierarchical cancellation scopes for modern JavaScript runtimes.

Downloads

15

Readme

@abortor/core

Hierarchical cancellation scopes for modern JavaScript runtimes.

Built on top of the platform's native AbortController / AbortSignal, @abortor/core makes cancellation composable, structured, and developer‑friendly.


Features

  • Hierarchical cancellation: disposing a parent scope cancels all of its descendants.
  • Scoped async: run work inside a scope.run(fn) and it automatically tracks lifetime.
  • Fetch integration: scope.fetch() threads the scope's signal into fetch calls.
  • Timeouts & composition: use scope.timeout(ms) or combine signals with composeAny().
  • Diagnostics: dev‑mode warnings, strict mode checks, and perf marks for profiling.
  • Fallbacks: uses AbortSignal.any() and AbortSignal.timeout() if available; provides shims otherwise.

Installation

npm install @abortor/core
# or
pnpm add @abortor/core
yarn add @abortor/core

Requires Node.js 18+ or modern browsers with Abort APIs.


Quick Start

import { scope } from "@abortor/core";

// Create a new scope (optionally label it)
const s = scope({ label: "SearchBox" });

// Run async work inside the scope
const result = await s.run(async (sc) => {
  const res = await sc.fetch("https://jsonplaceholder.typicode.com/users");
  return res.json();
});

// Later, cancel everything under this scope
s.dispose("navigated away");

API Overview

scope(opts?)

Creates a new cancellation scope.

const s = scope({ label: string, parent: Scope });

A Scope exposes:

  • signal: AbortSignal — propagate into APIs like fetch
  • run(fn) — run async work bound to the scope
  • child(opts?) — create a nested scope
  • dispose(reason?) — cancel this scope and all children
  • fetch(input, init?) — like fetch, but auto‑uses the scope’s signal
  • timeout(ms, reason?) — create a timeout signal combined with this scope
  • race(promises) / all(promises) — helpers that cancel correctly

withScope(fn, opts?)

Utility to create a scope, run work, and auto‑dispose.

import { withScope } from "@abortor/core";

await withScope(async (sc) => {
  await sc.fetch("/api/data");
}); // auto‑disposed here

Diagnostics

import { configureDiagnostics } from "@abortor/core";

configureDiagnostics({
  warnings: true,
  strict: false,
  perf: false,
});
  • warnings: console.warn on leaks
  • strict: throw if missing signal usage
  • perf: mark/measure scopes in PerformanceTimeline

Utilities

composeAny(signals: AbortSignal[]): AbortSignal

Combine multiple signals; aborts when any does.

withTimeout(ms: number, parent?: AbortSignal, reason?: string): AbortSignal

Create a timeout signal, optionally combined with a parent.



Related packages

Also see:

@abortor/angular – Angular-specific integration with component lifecycle-aware cancellation.

@abortor/react — React hooks and utilities for cancellation-aware components (requires React 18+).

API Reference

View the Reference Docs