Skip to content

Latest commit

 

History

3 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

retry(tries, f)

retry is a function that takes an async function and returns a more persistent version of that function.

Why?

A lot of asynchronous functions are making network calls. And network calls can be unreliable. So maybe you'll want to try a few times before you give up.

example

const persistentFetch = retry(3, fetch)

// This will call fetch a maximum of three times
persistentFetch('http://example.com')
  .then((response) => response.json())
  .then((data) => console.log(data))

About

Make async functions try multiple times

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages