@liara/cli
Version:
The command line interface for Liara
17 lines (16 loc) • 398 B
JavaScript
import EventEmitter from 'node:events';
export default class Poller extends EventEmitter {
/**
* @param timeout how long should we wait after the poll started?
*/
constructor(timeout = 1000) {
super();
this.timeout = timeout;
}
poll() {
setTimeout(() => this.emit('poll'), this.timeout);
}
onPoll(cb) {
this.on('poll', cb);
}
}