mirror of
https://github.com/flynx/types.js.git
synced 2025-12-19 18:01:39 +00:00
made the task protocol a bit more flexible -- fixed queue interaction...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
6d5d56b510
commit
d18823c6a5
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ig-types",
|
||||
"version": "5.0.35",
|
||||
"version": "5.0.36",
|
||||
"description": "Generic JavaScript types and type extensions...",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
|
||||
15
runner.js
15
runner.js
@ -638,10 +638,20 @@ object.Constructor('TaskManager', Array, events.EventMixin('flat', {
|
||||
|
||||
// actions...
|
||||
//
|
||||
// commands to test as methods...
|
||||
// i.e. task.send(cmd, ...args) -> task[cmd](...args)
|
||||
__send_commands__: [ 'stop' ],
|
||||
send: function(title, ...args){
|
||||
var that = this
|
||||
if(title == 'all' || title == '*'){
|
||||
this.forEach(function(task){
|
||||
task.send(...args) })
|
||||
'send' in task ?
|
||||
task.send(...args)
|
||||
: that.__send_commands__.includes(args[0]) ?
|
||||
task[args[0]](...args.slice(1))
|
||||
// XXX
|
||||
: console.warn('.send(..): can\'t .send(..) to:', task)
|
||||
})
|
||||
return this }
|
||||
return this.titled(
|
||||
...(title instanceof Array) ?
|
||||
@ -747,7 +757,8 @@ object.Constructor('TaskManager', Array, events.EventMixin('flat', {
|
||||
task instanceof Queue ?
|
||||
task
|
||||
// task protocol...
|
||||
: task && task.then && task.stop ?
|
||||
: task && task.then
|
||||
&& (task.stop || task.send) ?
|
||||
task
|
||||
: this.__task_mixin__(
|
||||
// interactive promise...
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user