Comparing version 1.6.1 to 1.6.2
{ | ||
"name": "polly-js", | ||
"version": "1.6.1", | ||
"version": "1.6.2", | ||
"description": "Transient exception handling", | ||
@@ -5,0 +5,0 @@ "main": "src/polly.js", |
@@ -97,4 +97,23 @@ # polly-js | ||
Use async await with the browsers `fetch` API. | ||
```JavaScript | ||
const loadData = url => { | ||
return polly() | ||
.waitAndRetry(2) | ||
.executeForPromise(async () => { | ||
const rsp = await fetch(url); | ||
if (rsp.ok) { | ||
return rsp.json(); | ||
} | ||
return Promise.reject(rsp); | ||
}); | ||
}; | ||
// Using the function somewhere else: | ||
const movies = await loadData("http://localhost:3000/movies.json"); | ||
``` | ||
## Acknowledgements | ||
The library is based on the [Polly NuGet package](https://www.nuget.org/packages/Polly/) by Michael Wolfenden |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
252124
119