diff --git a/package.json b/package.json index eb233d8..0149c0e 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/runner.js b/runner.js index 2cbb243..8074d2b 100644 --- a/runner.js +++ b/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...