react-ddp
Version:
ddp client with subs, methods, minimongo supported without much work (see readme), will not make minimongo a dep.
24 lines (23 loc) • 489 B
JavaScript
//created by mondora, edited by streemo
export default class Queue {
constructor (fn) {
this.fn = fn;
this.args = [];
}
push (arg) {
this.args.push(arg);
this.process();
}
process () {
if (this.args.length !== 0) {
const ack = this.fn(this.args[0]);
if (ack) {
this.args.shift();
this.process();
}
}
}
empty () {
this.args = [];
}
}