experimenting...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2020-12-20 06:12:47 +03:00
parent b84c0229dd
commit af3f85ae4c
6 changed files with 71 additions and 19 deletions

View File

@ -148,7 +148,8 @@ function start(){
var _start = function(){
createSplash()
createWindow() }
// NOTE: by this time (arg parsing and stuff) the app may already be ready...
// NOTE: by this time (arg parsing and stuff) the app may already
// be ready...
app.isReady() ?
_start()
: app.on('ready', _start) }

View File

@ -181,7 +181,7 @@ var CLIActions = actions.Actions({
startREPL: ['- System/Start CLI interpreter',
{cli: {
name: '@repl',
interactive: true,
//interactive: true,
}},
function(){
var that = this
@ -429,6 +429,16 @@ var CLIActions = actions.Actions({
return index
.sortImages()
.saveIndex() }) }],
// XXX this is still wrong...
_makeIndex: ['- System/',
`chain:
"loadImages: $1"
"saveIndex"
"makePreviews: 'all'"
"sortImages"
"saveIndex"`],
// XXX does not work yet...
updateIndex: ['- System/Update index',
{cli: {

View File

@ -2944,43 +2944,73 @@ var TaskActions = actions.Actions({
// 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
// not want but that still takes time and memory...
// XXX sould we also do a fast clone or shallow clone???
__clones: null,
// XXX this does not copy aliases...
// XXX might be a good idea to add a 'IsolatedTask' feature/mixin to
// handle cleanup (via .done() action)
// XXX should this be a prop -- .isolated???
__isolated: null,
get isolated(){
return (this.__isolated = this.__isolated || []) },
isolate: ['- System/',
function(){
var clones = this.__clones = this.__clones || []
var clones = this.isolated
var clone = this.clone(true)
// reset actions to exclude UI...
// XXX this still has all the ui handlers setup...
clone.__proto__ = ImageGridFeatures.setup([...this.features.input, '-ui'])
clone.parent = this
// link clone in...
clone.logger = this.logger.push(['Task', clones.length].join(' '))
clones.push(clone)
return clone }],
// XXX this is the same as LinkedTask(..) make a meta-function...
IsolatedTask: ['- System/',
function(action, ...args){
var that = this
var context = this.isolate
var res = context[action](...args)
var cleanup = function(){
var l = (that.__isolated || [])
l.includes(context)
&& l.splice(l.indexOf(context), 1) }
res.then ?
res.finally(cleanup)
: cleanup()
return res === context ?
undefined
: res }],
// Create a new ig instance with the same data...
//
// This will reflect the data changes while when the main index is
// cleared or reloaded this will retain the old data...
__links: null,
//
// XXX should this be a prop -- .linked???
__linked: null,
get linked(){
return (this.__linked = this.__linked || []) },
link: ['- System/',
function(){
var that = this
var links = this.__links = this.__links || []
// XXX we need to only link it part of the data, for example
// ._action_handlers is action-set specific and should
// not be overwritten...
var links = this.linked
var link = ImageGridFeatures.setup([...this.features.input, '-ui'])
// XXX this is not a clean clone...
return Object.assign(
link,
this)
this,
{parent: this})
.run(function(){
this.logger = that.logger.push(['Task', links.length].join(' '))
links.push(this) }) }],
// XXX this should delete the clone when done...
LinkedTask: ['- System/',
function(){}],
})
var Tasks =

View File

@ -856,6 +856,17 @@ var SharpActions = actions.Actions({
return gid }) })],
cacheAllMetadata: ['- Sharp/Image/',
'cacheMetadata: "all" ...'],
// XXX EXPERIMENTAL...
makePreviewsAndSave: ['- Sharp|File/',
function(){
var link = this.link()
return link
.makePreviews(...arguments)
.then(function(){
link.saveIndex
&& link.saveIndex() }) }],
})

View File

@ -1181,9 +1181,9 @@
"integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg=="
},
"ig-actions": {
"version": "3.24.28",
"resolved": "https://registry.npmjs.org/ig-actions/-/ig-actions-3.24.28.tgz",
"integrity": "sha512-3Um0eHHg15y6bxpLZV+FB88qtBro9iXXHNcoOvOf64I4eu+VPThSe3HBUkw03V81Qv19dSlmNYIPHXU1LcMbRw==",
"version": "3.24.29",
"resolved": "https://registry.npmjs.org/ig-actions/-/ig-actions-3.24.29.tgz",
"integrity": "sha512-qfb4zda/cQQ3feOCXO97EOn5i/ac8Zei1CXeiTZlwo+QgtpGdSLC6/pV6Dby+8ikjWLfxVhbd/lK0hBk3g39Jw==",
"requires": {
"ig-object": "^5.4.12"
}

View File

@ -30,7 +30,7 @@
"generic-walk": "^1.4.0",
"glob": "^7.1.6",
"guarantee-events": "^1.0.0",
"ig-actions": "^3.24.28",
"ig-actions": "^3.24.29",
"ig-argv": "^2.16.3",
"ig-features": "^3.4.5",
"ig-object": "^5.4.14",