gitwtfhub

wtf is cancellation?

gaearon/cancellation — explained in plain English

Analysis updated 2026-07-17 · repo last pushed 2015-01-19

1JavaScriptAudience · developerComplexity · 2/5DormantSetup · easy

TL;DR

A JavaScript library that lets you cleanly stop a running async operation, like an HTTP request or long loop, using a cancellation token.

Mindmap

mindmap
  root((repo))
    What it does
      Cancels async operations
      Provides cancellation tokens
      Cleans up gracefully
    Tech stack
      JavaScript
    Use cases
      Abort HTTP requests
      Interrupt long computations
      Stop background loops
    Audience
      Web app developers
      Node.js server developers
      JavaScript engineers
    How it works
      Create token source
      Pass token to async function
      Call cancel to trigger cleanup

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

Why would anyone build with this?

REASON 1

Abort an in-progress file download or HTTP request when a user navigates away

REASON 2

Interrupt a long-running computation or loop cleanly instead of letting it run silently

REASON 3

Manage and shut down multiple background async tasks in a web app or Node.js server

What's in the stack?

JavaScript

How it stacks up

gaearon/cancellation0xmukesh/docusaurus-tutoriala15n/andrewscheuermann
Stars111
LanguageJavaScriptJavaScriptJavaScript
Last pushed2015-01-192021-12-272015-01-11
MaintenanceDormantDormantDormant
Setup difficultyeasyeasymoderate
Complexity2/52/51/5
Audiencedeveloperdevelopergeneral

Figures from each repo's GitHub metadata at analysis time.

How do you spin it up?

Difficulty · easy Time to first run · 5min

Yoink these prompts

Prompt 1
Show me how to create a cancellation token source with this library and pass it to an async function.
Prompt 2
Help me add cancellation support to my HTTP request function using this library.
Prompt 3
Explain how to check for cancellation inside a loop and clean up when it's triggered.
Prompt 4
Help me stop a long-running background task gracefully when a user cancels an action.

Frequently asked questions

wtf is cancellation?

A JavaScript library that lets you cleanly stop a running async operation, like an HTTP request or long loop, using a cancellation token.

What language is cancellation written in?

Mainly JavaScript. The stack also includes JavaScript.

Is cancellation actively maintained?

Dormant — no commits in 2+ years (last push 2015-01-19).

How hard is cancellation to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is cancellation for?

Mainly developer.

View the repo → Decode another repo

This repo across BitVibe Labs

Don't trust strangers blindly. Verify against the repo.