Skip to content

Commit cd3c44a

Browse files
authored
Meta tweak
Fixes #3
1 parent 09db573 commit cd3c44a

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

index.d.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@ Create an AbortSignal that aborts after a delay.
77
```
88
import timeoutSignal from 'timeout-signal';
99
10+
const signal = timeoutSignal(5000);
11+
1012
try {
11-
const response = await fetch('https://www.google.com', {signal: timeoutSignal(5000)});
13+
const response = await fetch('https://www.google.com', {signal});
1214
// Handle response
1315
} catch (error) {
1416
if (signal.aborted) {

readme.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,10 @@ npm install timeout-signal
1313
```js
1414
import timeoutSignal from 'timeout-signal';
1515

16+
const signal = timeoutSignal(5000);
17+
1618
try {
17-
const response = await fetch('https://www.google.com', {signal: timeoutSignal(5000)});
19+
const response = await fetch('https://www.google.com', {signal});
1820
// Handle response
1921
} catch (error) {
2022
if (signal.aborted) {

0 commit comments

Comments
 (0)