tryloop
Version:
Simple library for retrying operations, it supports multiple backoff strategies.
19 lines (18 loc) • 396 B
JavaScript
/* IMPORT */
import Abstract from './abstract.js';
/* MAIN */
class Linear extends Abstract {
/* CONSTRUCTOR */
constructor(options) {
super(options);
this.options = Object.assign({
interval: 100
}, this.options);
}
/* API */
schedule(fn) {
setTimeout(() => fn(), this.options.interval);
}
}
/* EXPORT */
export default Linear;