Skip to content

Commit

Permalink
improve chain README; add coverage badges to repo README
Browse files Browse the repository at this point in the history
  • Loading branch information
kyle-johnson committed Jan 15, 2022
1 parent fb35dd8 commit b1c0255
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/small-parrots-vanish.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"abortcontroller-chain": patch
---

Explain _why_ chaining is useful.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
[AbortControllers](https://developer.mozilla.org/en-US/docs/Web/API/AbortController) and [AbortSignals](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) are awesome, but they are extremely simple building blocks.
# AbortController Utilities
[![GitHub Workflow Status](https://img.shields.io/github/workflow/status/kyle-johnson/abortcontroller-utils/CI)](https://github.com/kyle-johnson/abortcontroller-utils/actions)

These utilities bring a few more _bulding blocks_ to make use of AbortController/AbortSignal a bit more concise for common use cases.
[AbortControllers](https://developer.mozilla.org/en-US/docs/Web/API/AbortController) and [AbortSignals](https://developer.mozilla.org/en-US/docs/Web/API/AbortSignal) are awesome, but they are very simple building blocks.

These utilities bring a few more bulding blocks to make common use cases easy, such as [creating a deadline](./packages/deadline) or [chaining multiple signals into one controller](./packages/chain).

## [`abortcontroller-chain`](./packages/chain)
[![npm](https://img.shields.io/npm/v/abortcontroller-chain)](https://www.npmjs.com/package/abortcontroller-chain)
[![Codecov](https://img.shields.io/codecov/c/github/kyle-johnson/abortcontroller-utils?flag=chain&label=coverage)](https://app.codecov.io/gh/kyle-johnson/abortcontroller-utils/)

Contect an AbortController to one or more AbortSignals.

## [`abortcontroller-deadline`](./packages/deadline)
[![npm](https://img.shields.io/npm/v/abortcontroller-deadline)](https://www.npmjs.com/package/abortcontroller-deadline)
[![Codecov](https://img.shields.io/codecov/c/github/kyle-johnson/abortcontroller-utils?flag=deadline&label=coverage)](https://app.codecov.io/gh/kyle-johnson/abortcontroller-utils/)


Easily create an AbortController which aborts after a specified amount of time (a _deadline_).
2 changes: 1 addition & 1 deletion packages/chain/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[![license](https://img.shields.io/npm/l/abortcontroller-chain)](https://github.com/kyle-johnson/abortcontroller-utils/blob/main/packages/chain/LICENSE)
[![Codecov](https://img.shields.io/codecov/c/github/kyle-johnson/abortcontroller-utils?flag=chain&label=coverage)](https://app.codecov.io/gh/kyle-johnson/abortcontroller-utils/)

Chain multiple signals into one controller: if any of the signals aborts, the controller will be aborted.
Chain multiple signals into one controller: if any of the signals aborts, the controller will be aborted. This is particularly useful since most APIs only accept a _single_ AbortSignal input ([`fetch()`](https://developer.mozilla.org/en-US/docs/Web/API/fetch), [axios](https://github.com/axios/axios#cancellation), the [AWS SDK](https://aws.amazon.com/blogs/developer/abortcontroller-in-modular-aws-sdk-for-javascript/), etc).

Works with browsers, NodeJS (16+), and spec-compliant polyfills.

Expand Down

0 comments on commit b1c0255

Please sign in to comment.