(#4071) - remove dead code from TaskQueue
diff --git a/lib/taskqueue.js b/lib/taskqueue.js
index 6756899..a67556a 100644
--- a/lib/taskqueue.js
+++ b/lib/taskqueue.js
@@ -9,28 +9,14 @@
}
TaskQueue.prototype.execute = function () {
- var d, func;
+ var fun;
if (this.failed) {
- while ((d = this.queue.shift())) {
- if (typeof d === 'function') {
- d(this.failed);
- continue;
- }
- func = d.parameters[d.parameters.length - 1];
- if (typeof func === 'function') {
- func(this.failed);
- } else if (d.name === 'changes' && typeof func.complete === 'function') {
- func.complete(this.failed);
- }
+ while ((fun = this.queue.shift())) {
+ fun(this.failed);
}
- } else if (this.isReady) {
- while ((d = this.queue.shift())) {
-
- if (typeof d === 'function') {
- d();
- } else {
- d.task = this.db[d.name].apply(this.db, d.parameters);
- }
+ } else {
+ while ((fun = this.queue.shift())) {
+ fun();
}
}
};
@@ -41,28 +27,14 @@
};
TaskQueue.prototype.ready = function (db) {
- if (this.failed) {
- return false;
- } else if (arguments.length === 0) {
- return this.isReady;
- }
- this.isReady = db ? true: false;
+ this.isReady = true;
this.db = db;
this.execute();
};
-TaskQueue.prototype.addTask = function (name, parameters) {
- if (typeof name === 'function') {
- this.queue.push(name);
- if (this.failed) {
- this.execute();
- }
- } else {
- var task = { name: name, parameters: parameters };
- this.queue.push(task);
- if (this.failed) {
- this.execute();
- }
- return task;
+TaskQueue.prototype.addTask = function (fun) {
+ this.queue.push(fun);
+ if (this.failed) {
+ this.execute();
}
};