mirror of
https://github.com/flynx/types.js.git
synced 2025-12-19 09:51:40 +00:00
cleanup...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
cae17a0986
commit
e6441cb661
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ig-types",
|
||||
"version": "5.0.38",
|
||||
"version": "5.0.39",
|
||||
"description": "Generic JavaScript types and type extensions...",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
|
||||
12
runner.js
12
runner.js
@ -423,6 +423,10 @@ object.Constructor('Queue', Array, {
|
||||
//
|
||||
// NOTE: adding tasks via the [..] notation will not trigger the
|
||||
// event...
|
||||
// XXX add methods that can shorten the queue (like .pop()/.shift()/..)
|
||||
// to test and trigger .queueEmpty()
|
||||
// ...this is not and will not be done on polling as that would
|
||||
// introduce issues -- queue can change between task runs... (revise!)
|
||||
push: function(...tasks){
|
||||
res = object.parentCall(Queue.prototype.push, this, ...tasks)
|
||||
this.trigger('tasksAdded', tasks)
|
||||
@ -432,10 +436,13 @@ object.Constructor('Queue', Array, {
|
||||
this.trigger('tasksAdded', tasks)
|
||||
return res },
|
||||
splice: function(...args){
|
||||
var l = this.length
|
||||
res = object.parentCall(Queue.prototype.splice, this, ...args)
|
||||
var tasks = args.slice(2)
|
||||
tasks.length > 0
|
||||
&& this.trigger('tasksAdded', tasks)
|
||||
l != 0 && this.length == 0
|
||||
&& this.trigger('queueEmpty')
|
||||
return res },
|
||||
|
||||
// shorthands...
|
||||
@ -443,10 +450,7 @@ object.Constructor('Queue', Array, {
|
||||
this.push(...tasks)
|
||||
return this },
|
||||
clear: function(){
|
||||
this.splice(0, this.length)
|
||||
this.trigger('queueEmpty')
|
||||
if(this.state == 'running'){
|
||||
this.trigger('stop') } },
|
||||
this.splice(0, this.length) },
|
||||
|
||||
|
||||
// constructor argument handling...
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user