mirror of
https://github.com/flynx/types.js.git
synced 2025-12-19 09:51:40 +00:00
now queue collects results by default...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
051c7ab58f
commit
3f7368b756
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ig-types",
|
||||
"version": "5.0.41",
|
||||
"version": "5.1.0",
|
||||
"description": "Generic JavaScript types and type extensions...",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
|
||||
19
runner.js
19
runner.js
@ -111,6 +111,9 @@ object.Constructor('Queue', Array, {
|
||||
// If true, stop after queue is depleted...
|
||||
auto_stop: false,
|
||||
|
||||
// NOTE: for long running queues this may get quite big...
|
||||
collect_results: true,
|
||||
|
||||
// Sub-queue handling mode...
|
||||
//
|
||||
// This can be:
|
||||
@ -205,7 +208,10 @@ object.Constructor('Queue', Array, {
|
||||
var that = this
|
||||
return new Promise(function(resolve, reject){
|
||||
that.one('queueEmpty', function(){
|
||||
resolve(func()) }) }) },
|
||||
resolve(func(
|
||||
...(this.collect_results ?
|
||||
[(this.__results || [])]
|
||||
: []) )) }) }) },
|
||||
|
||||
// Runner API...
|
||||
//
|
||||
@ -387,9 +393,15 @@ object.Constructor('Queue', Array, {
|
||||
var stop = res === module.STOP
|
||||
|| res instanceof module.STOP
|
||||
res = res instanceof module.STOP ?
|
||||
res.value
|
||||
res.value
|
||||
: res === module.STOP ?
|
||||
undefined
|
||||
: res
|
||||
|
||||
// collect results...
|
||||
this.collect_results
|
||||
&& (this.__results = this.__results || []).push(res)
|
||||
|
||||
// handle task results...
|
||||
//
|
||||
// queue -- as a set of tasks...
|
||||
@ -435,7 +447,8 @@ object.Constructor('Queue', Array, {
|
||||
stop
|
||||
&& this.stop()
|
||||
|
||||
return this },
|
||||
return res },
|
||||
//return this },
|
||||
|
||||
|
||||
// helpers...
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user