hxnodejs-backoff

Externs for the backoff NPM module
https://github.com/proletariatgames/hxnodejs-backoff

To install, run:

haxelib install hxnodejs-backoff 2.5.0-alpha 

See using Haxelib in Haxelib documentation for more information.

README.md

Haxe/hxnodejs externs for the backoff npm library

Tested using backoff version 2.5.0

Example:

import js.npm.Backoff;

var fibonacciBackoff = js.npm.Backoff.fibonacci({
    randomisationFactor: 0,
    initialDelay: 10,
    maxDelay: 300
});
 
fibonacciBackoff.failAfter(10);
 
fibonacciBackoff.on(BackoffEvent.Backoff, function(number, delay) {
    // Do something when backoff starts, e.g. show to the 
    // user the delay before next reconnection attempt. 
    trace(number + ' ' + delay + 'ms');
});
 
fibonacciBackoff.on(BackoffEvent.Ready, function(number, delay) {
    // Do something when backoff ends, e.g. retry a failed 
    // operation (DNS lookup, API call, etc.). If it fails 
    // again then backoff, otherwise reset the backoff 
    // instance. 
    fibonacciBackoff.backoff();
});
 
fibonacciBackoff.on(BackoffEvent.Fail, function() {
    // Do something when the maximum number of backoffs is 
    // reached, e.g. ask the user to check its connection. 
    trace('fail');
});
 
fibonacciBackoff.backoff();
Contributors
waneck
lpetre
Proletariat
danogles
Version
2.5.0-alpha
Published
10 years ago
Dependencies
License
MIT

All libraries are free

Every month, more than a thousand developers use Haxelib to find, share, and reuse code — and assemble it in powerful new ways. Enjoy Haxe; It is great!

Explore Haxe

Haxe Manual

Haxe Code Cookbook

Haxe API documentation

You can try Haxe in the browser! try.haxe.org

Join us on GitHub!

Haxe is being developed on GitHub. Feel free to contribute or report issues to our projects.

Haxe on GitHub

⌂