mirror of
https://github.com/flynx/types.js.git
synced 2025-10-29 02:20:07 +00:00
added sync/async task start option on task creation...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
fcb018b67a
commit
0f7640e11f
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ig-types",
|
||||
"version": "5.0.17",
|
||||
"version": "5.0.18",
|
||||
"description": "Generic JavaScript types and type extensions...",
|
||||
"main": "main.js",
|
||||
"scripts": {
|
||||
|
||||
15
runner.js
15
runner.js
@ -503,10 +503,21 @@ object.Constructor('TaskManager', Array, events.EventMixin('flat', {
|
||||
// ...this needs to work with all the event methods...
|
||||
Task: function(title, task, ...args){
|
||||
var that = this
|
||||
var _args = [...arguments]
|
||||
|
||||
// parse args...
|
||||
var sync_start = this.sync_start
|
||||
if(title == 'sync' || title == 'async'){
|
||||
;[sync_start, title, task, ...args] = _args
|
||||
sync_start = sync_start == 'sync'
|
||||
|
||||
} else if(task == 'sync' || task == 'async'){
|
||||
;[title, sync_start, task, ...args] = _args
|
||||
sync_start = sync_start == 'sync' }
|
||||
|
||||
// anonymous task...
|
||||
if(typeof(title) != typeof('str')){
|
||||
;[task, ...args] = arguments
|
||||
;[task, ...args] = _args
|
||||
title = null }
|
||||
|
||||
// normalize handler...
|
||||
@ -582,7 +593,7 @@ object.Constructor('TaskManager', Array, events.EventMixin('flat', {
|
||||
task.start()
|
||||
: null }
|
||||
// trigger task start...
|
||||
this.sync_start ?
|
||||
sync_start ?
|
||||
start()
|
||||
: setTimeout(start, 0)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user