|
|
|
@ -1,6 +1,6 @@
|
|
|
|
|
# Abortable promises ⚡
|
|
|
|
|
|
|
|
|
|
A module for node that lets you run complex sequence of async functions and:
|
|
|
|
|
A module for node that lets you run complex sequence of async steps and:
|
|
|
|
|
|
|
|
|
|
1. Use an external signal to stop the sequence of steps
|
|
|
|
|
|
|
|
|
@ -21,7 +21,7 @@ const a = new AbortablePromise(async function* () {
|
|
|
|
|
setTimeout(() => a.abort(), 1500); // doesn't get to sleep(3000)
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
2. Use an external signal to kill an already started asynchronous step
|
|
|
|
|
2. Use an external signal to kill an _already started_ asynchronous step
|
|
|
|
|
|
|
|
|
|
```typescript
|
|
|
|
|
const b = new AbortablePromise(async function* (await_or_abort) {
|
|
|
|
|