# getify/CAF

Cancelable Async Flows (CAF)

Repository: https://github.com/getify/CAF
Canonical: https://ross.abutalabs.com/products/caf
Language: JavaScript
License: MIT
License Family: permissive
Topics: async, library, cancelable, promises, javascript
Last push: 2022-08-27T15:09:24+00:00

## Health v2 (maintenance only)
Score: 32/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 0, release rhythm 35, longevity 100
- inputs: {"age_days": 3160, "days_push": 1467, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1360, forks 49 (observed 2026-08-28T04:04:29.891355+00:00)

## What it is
CAF (Cancelable Async Flows) is a JavaScript library that wraps function* generators so they behave like async functions while supporting external cancellation via cancellation tokens. It also includes CAG for emulating async generators, with cancellation signals that cascade across chained calls.

## Use cases
- cancel an async operation like a timed-out ajax request
- treat generators as cancelable async functions in JavaScript
- cascade a single cancellation signal through a chain of async calls
- abort a promise chain mid-flight when a timeout elapses
- emulate async generators in environments without native support

## When to choose
- you need to cancel in-flight async flows, which native async functions can't do
- you want synchronous-looking async logic with cooperative cancellation tokens
- you're on ES2018+ JavaScript in Node or the browser

## When to avoid
- you need to support pre-ES2018 environments without transpiling
- your async operations are short-lived and cancellation isn't needed
- you prefer native async/await and AbortController-based cancellation

## Facets
- artifact type: library
- maturity: maintenance
- function: concurrency, developer-tools
- domain: developer-tools, web-development
- platform: browser, cross-platform
- tags: async, promises, generators, cancellation, cancel-token, javascript, nodejs

## Member repositories
- getify/CAF (main) score 32

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:04:29.891355+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T04:41:39.068407+00:00, confidence not recorded.
  - readme: https://github.com/getify/CAF (fetched 2026-08-28T04:04:29.891355+00:00, sha 9e15bcba326c)
  - registry_npm: https://registry.npmjs.org/caf (fetched 2026-08-29T11:59:43.011094+00:00, sha 652967f16a8f)
- Data as of 2026-08-30T08:39:29.467469+00:00.
