experimenting with contexts...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2020-12-22 05:18:33 +03:00
parent 0019c77445
commit 9878b72a1e
3 changed files with 42 additions and 10 deletions

View File

@ -2947,7 +2947,20 @@ var TaskActions = actions.Actions({
// isolated tasks (XXX EXPERIMENTAL)
// contexts (XXX EXPERIMENTAL)
//
// XXX would be nice to have a context manager:
// - context id's (index? ...sparse array?)
// - manager API
// - create/remove
// - context api (feature)
// .then(..)/.catch(..)/.finally(..)
// XXX is peer stuff just a special context???
// ...feels like yes
// XXX is context manager a special case of task manager???
// XXX move to a separate feature...
get contexts(){},
// XXX would be nice to have an ability to partially clone the instance...
// ...currently we can do a full clone and remove things we do
@ -2970,7 +2983,7 @@ var TaskActions = actions.Actions({
// link clone in...
clone.logger = this.logger.push(['Task', clones.length].join(' '))
clones.push(clone)
clone.context_id = clones.push(clone)
return clone }],
// XXX this is the same as LinkedTask(..) make a meta-function...
IsolatedTask: ['- System/',
@ -2999,22 +3012,41 @@ var TaskActions = actions.Actions({
// cleared or reloaded this will retain the old data...
//
// XXX should this be a prop -- .linked???
// XXX would be a good idea to store all the links in once place...
__linked: null,
get linked(){
return (this.__linked = this.__linked || []) },
link: ['- System/',
function(){
function(title){
var that = this
var links = this.linked
var link = ImageGridFeatures.setup([...this.features.input, '-ui'])
// get link already created...
var link = this.linked
.filter(function(l){
return title ?
l.title == title
: (l.data === that.data
&& l.images === that.images) })
.last()
if(link){
return link }
// create a link...
link = ImageGridFeatures.setup([...this.features.input, '-ui'])
return Object.assign(
link,
this,
{parent: this})
{
// XXX revise...
parent: this,
title: title,
// XXX change this when data/images changes...
type: 'link',
})
.run(function(){
this.logger = that.logger.push(['Task', links.length].join(' '))
links.push(this) }) }],
this.context_id = links.push(this) }) }],
// XXX this should delete the clone when done...
LinkedTask: ['- System/',
function(){}],

View File

@ -1211,9 +1211,9 @@
"integrity": "sha512-7gSU0Qg4E0rnCPuITu6nJzgr4N73tFN57CISVrQjB+EglixfDI5SwOVRgPtG0EBOgtE8IL4O7fmq/UV87OUYyA=="
},
"ig-types": {
"version": "6.0.4",
"resolved": "https://registry.npmjs.org/ig-types/-/ig-types-6.0.4.tgz",
"integrity": "sha512-6127GzvMz1Ow8Qizbs0vEvMdYsOJR9HVs0By8dQJIYnX2RRAviUStI+E/wwEH/OxHZpkmFHxwZ6xvmC0S7KP3w==",
"version": "6.0.6",
"resolved": "https://registry.npmjs.org/ig-types/-/ig-types-6.0.6.tgz",
"integrity": "sha512-TOW58/yBQ7YqFukFT5K2Qd7u9k1CYgoQXXreS6u7pw9ttcWJLC3hJUTcLWsHTPKm3vNbFJ0NVI1o1U3SQlUu5w==",
"requires": {
"ig-object": "^5.4.12",
"object-run": "^1.0.1"

View File

@ -34,7 +34,7 @@
"ig-argv": "^2.16.3",
"ig-features": "^3.4.5",
"ig-object": "^5.4.14",
"ig-types": "^6.0.4",
"ig-types": "^6.0.6",
"json5": "^2.1.3",
"object-run": "^1.0.1",
"requirejs": "^2.3.6",