You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
663 B
30 lines
663 B
/**
|
|
* @constructor
|
|
* @param {Function} processor
|
|
*/
|
|
function SingleElementQueue(processor) {
|
|
this.processor = processor;
|
|
this.current = null;
|
|
}
|
|
|
|
SingleElementQueue.prototype.add = function (element) {
|
|
if (this.current != null) {
|
|
process.stderr.write("mocha-intellij: unexpectedly unprocessed element " + element);
|
|
this.processor(this.current);
|
|
}
|
|
this.current = element;
|
|
};
|
|
|
|
SingleElementQueue.prototype.processAll = function () {
|
|
if (this.current != null) {
|
|
this.processor(this.current);
|
|
this.current = null;
|
|
}
|
|
};
|
|
|
|
SingleElementQueue.prototype.clear = function () {
|
|
this.current = null;
|
|
};
|
|
|
|
module.exports = SingleElementQueue;
|