HurryUp is a timeout library for asynchronous, fault-prone function calls. Basically, it'll timeout an async call if it's been running for too long. You can also specify to re-call async functions until they succeed (see below).
What can you use it for?
asyncCallback- async function to call
object- options passed
retry- TRUE if the timedCallback should be re-called if it returns an error
retryTimeout- timeout between retrying timed callback
timeout- kill timeout
number- the timeout before killing the function call
...args- additional arguments to pass to the async callback
hurryUp//this will cause an errorsetTimeoutnext 2000;1000callnullconsole.error"timeout has occurred!"
Here's an easier way to wrap around a method:
hurryUpemitteronce 1000callemitter "connected";
You can also use hurryup to run a callback multiple times until it succeeds, like so:
//async stuff herenext"no!";hurryUpisItReadynext;retry: true callnullconsole.logerrmessage; //no!;