Skip to content

Commit

Permalink
docs(async): add documentation for timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
lambdalisue committed Jul 10, 2021
1 parent da5beb4 commit 1600203
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions async/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -130,3 +130,16 @@ const [branch1, branch2] = tee(gen());
}
})();
```

## timeout

Create a promise which will be rejected with `TimeoutError` when a given delay
is exceeded.

```typescript
import { timeout } from "https://deno.land/std/async/mod.ts";

const delayedPromise = delay(1000);
const result = await timeout(delayedPromise, 10);
// Above throws `TimeoutError` after 10 ms
```

0 comments on commit 1600203

Please sign in to comment.