refactor docs for clear method

This commit is contained in:
İlker Yıldırım 2020-09-03 21:44:41 +03:00
parent 834cc6354c
commit f0be27b908
2 changed files with 4 additions and 4 deletions

6
index.d.ts vendored
View File

@ -50,14 +50,14 @@ declare const pTimeout: {
default: typeof pTimeout;
/**
Timeout a promise after a specified amount of time. It returns a decorated promise having `.clear()` method to be able to clear timeout.
Timeout a promise after a specified amount of time.
If you pass in a cancelable promise, specifically a promise with a `.cancel()` method, that method will be called when the `pTimeout` promise times out.
@param input - Promise to decorate.
@param milliseconds - Milliseconds before timing out.
@param message - Specify a custom error message or error. If you do a custom error, it's recommended to sub-class `pTimeout.TimeoutError`. Default: `'Promise timed out after 50 milliseconds'`.
@returns A decorated `input` that times out after `milliseconds` time.
@returns A decorated `input` that times out after `milliseconds` time. Decorated input has a `.clear()` method, that method can be used to clear timeout.
@example
```
@ -85,7 +85,7 @@ declare const pTimeout: {
@param input - Promise to decorate.
@param milliseconds - Milliseconds before timing out. Passing `Infinity` will cause it to never time out.
@param fallback - Do something other than rejecting with an error on timeout. You could for example retry.
@returns A decorated `input` that times out after `milliseconds` time.
@returns A decorated `input` that times out after `milliseconds` time. Decorated input has a `.clear()` method, that method can be used to clear timeout.
@example
```

View File

@ -25,7 +25,7 @@ pTimeout(delayedPromise, 50).then(() => 'foo');
### pTimeout(input, milliseconds, message?, options?)
### pTimeout(input, milliseconds, fallback?, options?)
Returns a decorated `input` that times out after `milliseconds` time. Decorated input has `.clear()` method to be able to clear timeout.
Returns a decorated `input` that times out after `milliseconds` time. Decorated input has a `.clear()` method, that method can be used to clear timeout.
If you pass in a cancelable promise, specifically a promise with a `.cancel()` method, that method will be called when the `pTimeout` promise times out.