airship-server
Version:
Airship is a framework for Node.JS & TypeScript that helps you to write big, scalable and maintainable API servers.
20 lines • 550 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
class CallbackQueue {
constructor(countPerSec) {
this._queue = [];
this._delay = 1000 / countPerSec;
setInterval(() => {
if (this._queue.length !== 0) {
const func = this._queue.shift();
if (func)
func();
}
}, this._delay);
}
push(func) {
this._queue.push(func);
}
}
exports.default = CallbackQueue;
//# sourceMappingURL=CallbackQueue.js.map