jsmdb
Version:
JSMumps Database Component
39 lines (32 loc) • 733 B
JavaScript
/*
* JSMumps Database API
*
* synqueue.js: implementation of the synchronous queue
*
*
* Copyright (C) 2020, 2021 Coherent Logic Development LLC
*
* Author: John P. Willis <jpw@coherent-logic.com>
*
*/
function SynQueue(instance, callback)
{
this.instance = instance;
this.queue = [];
this.callback = callback || function(result) {};
return this;
}
SynQueue.prototype.enqueue = function(operation, global, subscripts) {
this.queue.push({
operation: operation,
global: global,
subscripts: subscripts
});
};
SynQueue.prototype.empty = function() {
this.queue = [];
};
SynQueue.prototype.run = function() {
this.instance.dispatch("synQueueRun", this.queue, this.callback);
};
module.exports = SynQueue;