You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
Tlekbai Ali 6c9706625f
Update README.md
4 years ago
..
README.md Update README.md 4 years ago

README.md

Keep Trying Or Giveup

Instructions

Create a retry function, that takes 2 arguments

  • a count indicates maximum amount of retries
  • an async callback, that will be called on every try

retry returns a function that calls and returns value from callback function passing its arguments and catches errors. If number of errors exceeds count then throw an Error.

for count of 3, the function will be called at most 4 times: the initial call + 3 retries.

Create a timeout function, that takes 2 arguments

  • a delay indicates maximum wait time
  • an async callback, that will be called

timeout returns a function either that calls and returns value from callback function passing its arguments or returns Error('timeout') if callback didn't resolve before delay time has reached.

Notions