Comparing version 3.1.1 to 3.1.2
{ | ||
"name": "ts-retry", | ||
"version": "3.1.1", | ||
"version": "3.1.2", | ||
"main": "lib/cjs/index.js", | ||
@@ -5,0 +5,0 @@ "module": "lib/esm/index.js", |
@@ -18,5 +18,6 @@ # ts-retry | ||
## How to: | ||
## How to | ||
- to retry something: | ||
```javascript | ||
@@ -30,3 +31,5 @@ const result = await retry( | ||
``` | ||
- to retry something async : | ||
```javascript | ||
@@ -40,3 +43,5 @@ const result = await retryAsync( | ||
``` | ||
- to retry until the answer is 42 : | ||
```javascript | ||
@@ -62,2 +67,3 @@ try { | ||
``` | ||
- Need to call a function at multiple locations with same retryOptions ? Use decorators: | ||
@@ -84,6 +90,9 @@ | ||
- to wait: | ||
```javascript | ||
await wait(10000); // Wait for 10 seconds | ||
``` | ||
- to set a timeout: | ||
```javascript | ||
@@ -103,3 +112,5 @@ try { | ||
``` | ||
- to set a timeout on something async: | ||
```javascript | ||
@@ -118,3 +129,5 @@ try { | ||
``` | ||
- Need to call a function at multiple locations with same retryOptions ? Use decorators: | ||
```javascript | ||
@@ -129,2 +142,3 @@ const fn = (title: string, count:number) => /* a long task */; | ||
``` | ||
```javascript | ||
@@ -198,3 +212,4 @@ const fn = async (name: string): Promise<any> => { | ||
When an option value is not provided, the default one is applied. The default options are: | ||
``` | ||
```javascript | ||
delay: 250, | ||
@@ -204,2 +219,3 @@ maxTry: 4 * 60, | ||
``` | ||
- `setDefaultRetryOptions<T>(retryOptions: RetryOptions<T>)`: change the default retryOptions. | ||
@@ -221,3 +237,3 @@ - `getDefaultRetryOptions<T>()`: returns the current default retry options. | ||
``` | ||
```javascript | ||
(parameter: { | ||
@@ -395,3 +411,3 @@ currentTry: number, | ||
```typescript | ||
```javascript | ||
const delay = createExponetialDelay(20); | ||
@@ -417,3 +433,3 @@ const result = await retryAsync( | ||
```typescript | ||
```javascript | ||
const delay = createMutiplicableDelay(20, 3); | ||
@@ -420,0 +436,0 @@ const delay = createExponetialDelay(20); |
85256
437