mirror of
https://github.com/flynx/types.js.git
synced 2025-10-28 10:00:08 +00:00
minor tweaking and refactoring...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
2276c4f73d
commit
97936a622a
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ig-types",
|
||||
"version": "6.24.19",
|
||||
"version": "6.24.20",
|
||||
"description": "Generic JavaScript types and type extensions...",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
|
||||
16
runner.js
16
runner.js
@ -362,6 +362,7 @@ object.Constructor('Queue', Array, {
|
||||
// report...
|
||||
that.trigger('taskCompleted', task, res) }
|
||||
var fail = {doc: 'fail runningDone(..)'}
|
||||
// XXX should this also remove .__running when empty???
|
||||
var runningDone = function(mode){
|
||||
running.splice(0, running.length,
|
||||
// NOTE: there can be multiple occurrences of res...
|
||||
@ -518,6 +519,9 @@ object.Constructor('Queue', Array, {
|
||||
//
|
||||
// NOTE: this helps get around the argument number limitation in JS...
|
||||
add: function(tasks){
|
||||
tasks = tasks instanceof Array ?
|
||||
tasks
|
||||
: [tasks]
|
||||
// handle too large a number of args...
|
||||
var MAX_ARGS = 10000
|
||||
if(tasks.length > MAX_ARGS){
|
||||
@ -570,6 +574,14 @@ module.FinalizableQueue =
|
||||
object.Constructor('FinalizableQueue', Queue, {
|
||||
auto_stop: true,
|
||||
|
||||
// not for direct use...
|
||||
__freeze: function(){
|
||||
Object.freeze(this)
|
||||
// XXX do we remove/freeze .__running???
|
||||
this.__results
|
||||
&& Object.freeze(this.__results)
|
||||
return this },
|
||||
|
||||
__onempty__: function(){
|
||||
return this.trigger('done') },
|
||||
|
||||
@ -579,14 +591,14 @@ object.Constructor('FinalizableQueue', Queue, {
|
||||
|| this.state == 'done'){
|
||||
return handle(false) }
|
||||
this.__state = 'done'
|
||||
Object.freeze(this) }),
|
||||
this.__freeze() }),
|
||||
abort: events.Event('abort', function(handle){
|
||||
// abort only once...
|
||||
if(this.state == 'aborted'
|
||||
|| this.state == 'done'){
|
||||
return handle(false) }
|
||||
this.__state = 'aborted'
|
||||
Object.freeze(this) }),
|
||||
this.__freeze() }),
|
||||
|
||||
// NOTE: each handler will get called once when the next time the
|
||||
// queue is emptied...
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user