Comparing version 4.2.2 to 4.3.0
@@ -5,3 +5,3 @@ "use strict"; | ||
* @author Jim Manton: jrman@risebroadband.net | ||
* @since 2021-03-22 | ||
* @since 2021-03-22l | ||
*/ | ||
@@ -16,24 +16,6 @@ | ||
var t = this | ||
t.aname = 'all.js' | ||
t.aname = 'all' | ||
t.process = t.process.bind(this) | ||
return t | ||
} | ||
process() { | ||
let t = this, obj | ||
if (t.getParent().resolve == null && t.getParent().reject == null) { | ||
return new Promise((resolve, reject) => { | ||
t.getParent().resolve = resolve | ||
t.getParent().reject = reject | ||
t.process() | ||
}); | ||
} | ||
obj = t.getParent().getObjectToProcess() | ||
if (typeof obj == 'undefined') { | ||
return t.getParent().resolve('done') | ||
} | ||
obj.process(()=>{ | ||
t.process() | ||
}) | ||
} | ||
} |
@@ -21,3 +21,66 @@ "use strict"; | ||
} | ||
process(props = null) { | ||
try { | ||
let t = this, obj, func | ||
if (t.getParent().resolve == null && t.getParent().reject == null) { | ||
return new Promise((resolve, reject) => { | ||
t.getParent().resolve = resolve | ||
t.getParent().reject = reject | ||
t.process() | ||
}); | ||
} | ||
switch (t.aname) { | ||
case 'all': | ||
obj = t.getParent().getObjectToProcess() | ||
if (typeof obj == 'undefined') { | ||
return t.getParent().resolve('done') | ||
} | ||
obj.process(() => { | ||
t.process() | ||
}) | ||
break | ||
case 'top_one': | ||
obj = t.getParent().getObjectToProcess() | ||
if (typeof obj == 'undefined') { | ||
return t.getParent().reject('nothing to process') | ||
} | ||
obj.process(() => { | ||
t.getParent().resolve('done') | ||
t.getParent().resolve = null | ||
t.getParent().reject = null | ||
}) | ||
break | ||
case 'bottom_one': | ||
obj = t.getParent().getBottomObjectToProcess() | ||
if (typeof obj == 'undefined') { | ||
return t.getParent().reject('nothing to process') | ||
} | ||
obj.process(() => { | ||
t.getParent().resolve('done') | ||
t.getParent().resolve = null | ||
t.getParent().reject = null | ||
}) | ||
break | ||
case 'func_all': | ||
func = t.getParent().getObjectToProcess() | ||
if (typeof func == 'undefined') { | ||
return t.getParent().resolve('done') | ||
} | ||
func(() => { | ||
t.process() | ||
}) | ||
break | ||
} | ||
} catch (e) { | ||
e.message = "queueObj base.js process error: " + e.message | ||
throw (e) | ||
} | ||
} | ||
} | ||
@@ -15,26 +15,5 @@ "use strict"; | ||
var t = this | ||
t.aname = 'all.js' | ||
t.aname = 'bottom_one' | ||
return t | ||
} | ||
process() { | ||
let t = this, obj | ||
if (t.getParent().resolve == null && t.getParent().reject == null) { | ||
return new Promise((resolve, reject) => { | ||
t.getParent().resolve = resolve | ||
t.getParent().reject = reject | ||
t.process() | ||
}); | ||
} | ||
obj = t.getParent().getBottomObjectToProcess() | ||
if (typeof obj == 'undefined') { | ||
return t.getParent().reject('nothing to process') | ||
} | ||
obj.process(()=>{ | ||
t.getParent().resolve('done') | ||
t.getParent().resolve = null | ||
t.getParent().reject = null | ||
}) | ||
} | ||
} |
@@ -11,34 +11,9 @@ "use strict"; | ||
exports = module.exports = class eval_all extends base { | ||
exports = module.exports = class func_all extends base { | ||
constructor(props) { | ||
super(props) | ||
var t = this | ||
t.aname = 'all.js' | ||
t.aname = 'func_all' | ||
return t | ||
} | ||
process() { | ||
let t = this, func | ||
try { | ||
if (t.getParent().resolve == null && t.getParent().reject == null) { | ||
return new Promise((resolve, reject) => { | ||
t.getParent().resolve = resolve | ||
t.getParent().reject = reject | ||
t.process() | ||
}); | ||
} | ||
func = t.getParent().getObjectToProcess() | ||
if (typeof func == 'undefined') { | ||
return t.getParent().resolve('done') | ||
} | ||
func(() => { | ||
t.process() | ||
}) | ||
} catch (e) { | ||
e.message = "eval_all process error: " + e.message | ||
console.log(e.message) | ||
throw (e) | ||
} | ||
} | ||
} |
@@ -15,26 +15,5 @@ "use strict"; | ||
var t = this | ||
t.aname = 'all.js' | ||
t.aname = 'top_one' | ||
return t | ||
} | ||
process() { | ||
let t = this, obj | ||
if (t.getParent().resolve == null && t.getParent().reject == null) { | ||
return new Promise((resolve, reject) => { | ||
t.getParent().resolve = resolve | ||
t.getParent().reject = reject | ||
t.process() | ||
}); | ||
} | ||
obj = t.getParent().getObjectToProcess() | ||
if (typeof obj == 'undefined') { | ||
return t.getParent().reject('nothing to process') | ||
} | ||
obj.process(()=>{ | ||
t.getParent().resolve('done') | ||
t.getParent().resolve = null | ||
t.getParent().reject = null | ||
}) | ||
} | ||
} |
@@ -5,3 +5,3 @@ { | ||
}, | ||
"version": "4.2.2", | ||
"version": "4.3.0", | ||
"bundleDependencies": false, | ||
@@ -8,0 +8,0 @@ "dependencies": { |
@@ -7,6 +7,6 @@ # QueueObj | ||
* all - process all added objects. | ||
* func_all - process functions to all added objects. | ||
* func_all - process custom functions to added objects. | ||
* top_one - process only the object in the 0(zero) position of the process array. | ||
* bottom_one - process only the object in the last position of the process array. | ||
* array - process object in various ways: all, items, or byIds. | ||
* array - process object in various ways: all, by items, or by Ids. | ||
@@ -35,4 +35,1 @@ Installation | ||
``` | ||
Usage | ||
--------- |
@@ -9,3 +9,3 @@ const assert = require('assert'), | ||
}, | ||
"version": "4.2.2", | ||
"version": "4.3.0", | ||
"bundleDependencies": false, | ||
@@ -12,0 +12,0 @@ "dependencies": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22158
649
34