rot-js
Version:
A roguelike toolkit in JavaScript
17 lines (16 loc) • 442 B
JavaScript
import Scheduler from "./scheduler.js";
/**
* @class Simple fair scheduler (round-robin style)
*/
export default class Simple extends Scheduler {
add(item, repeat) {
this._queue.add(item, 0);
return super.add(item, repeat);
}
next() {
if (this._current !== null && this._repeat.indexOf(this._current) != -1) {
this._queue.add(this._current, 0);
}
return super.next();
}
}