exponential backoff for angularjs
Note: This module was imported from backo by segmentio. I just build a wrapper for use in Angularjs.
bower install angular-backoff
Install withbower
Include the Backo
module into your app
app.module('myApp', ['Backo'])
In your controller
myApp.controller('myCtrl', function ($scope, Backoff) {
var backoff = new Backoff({ min: 100, max: 20000 });
setTimeout(function(){
something.reconnect();
}, backoff.duration());
// later when something works
backoff.reset()
})
- min initial timeout in milliseconds [100]
- max max timeout [10000]
- jitter [0]
- factor [2]
npm install
Install coffeescript and uglifymake all
Build js file and compress
MIT