reworked function task logic...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2020-11-25 16:58:05 +03:00
parent 262987d171
commit 6042cb5db1
2 changed files with 12 additions and 8 deletions

View File

@ -1,6 +1,6 @@
{
"name": "ig-types",
"version": "5.0.7",
"version": "5.0.8",
"description": "Generic JavaScript types and type extensions...",
"main": "main.js",
"scripts": {

View File

@ -456,15 +456,20 @@ object.Constructor('TaskManager', Array, events.EventMixin('flat', {
// we wrap this into run(..) and call it when
// the context is ready...
run = function(){
// NOTE: if the client calls resolve(..) this
// second resolve(..) call has no effect...
resolve(
task({
var res = task({
title,
resolve,
reject,
onmessage,
}, ...args)) } }))
}, ...args)
// NOTE: if the client calls resolve(..) this
// second resolve(..) call has no effect,
// and the same is true with reject...
// XXX is double binding like this (i.e.
// ticket + .then()) a good idea???
res instanceof Promise
&& res.then(resolve, reject)
} }))
// set handler title...
// NOTE: this will override the title of the handler if it was
// set before...
@ -473,8 +478,7 @@ object.Constructor('TaskManager', Array, events.EventMixin('flat', {
&& console.warn(
'TaskManager.Task(..): task title already defined:', handler.title,
'overwriting with:', title)
Object.assign(handler, {title})
}
Object.assign(handler, {title}) }
this.push(handler)