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.
 
 
 
 
 
 

1.1 KiB

Keep Trying Or Giveup

Instructions

Create a retry function, that takes 2 arguments

  • a count, that tells how many retries must be done
  • an async callback, that will be call every try

and it return a new function, passing arguments given to the callback on every tries.

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, that tells how long to wait
  • an async callback, that will be call

and it return a new function, passing arguments given to the callback and either the async callback resolve before the delay is reached, in that case we return the value from the callback, or reject an error using the message "timeout"

Notions