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(){ var _start = function(){
createSplash() createSplash()
createWindow() } 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() ? app.isReady() ?
_start() _start()
: app.on('ready', _start) } : app.on('ready', _start) }

View File

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

View File

@ -2944,43 +2944,73 @@ var TaskActions = actions.Actions({
// XXX would be nice to have an ability to partially clone the instance... // 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 // ...currently we can do a full clone and remove things we do
// not want but that still takes time and memory... // not want but that still takes time and memory...
// XXX sould we also do a fast clone or shallow clone??? // XXX this does not copy aliases...
__clones: null, // 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/', isolate: ['- System/',
function(){ function(){
var clones = this.__clones = this.__clones || [] var clones = this.isolated
var clone = this.clone(true) var clone = this.clone(true)
// reset actions to exclude UI... // reset actions to exclude UI...
// XXX this still has all the ui handlers setup...
clone.__proto__ = ImageGridFeatures.setup([...this.features.input, '-ui']) clone.__proto__ = ImageGridFeatures.setup([...this.features.input, '-ui'])
clone.parent = this
// link clone in... // link clone in...
clone.logger = this.logger.push(['Task', clones.length].join(' ')) clone.logger = this.logger.push(['Task', clones.length].join(' '))
clones.push(clone) clones.push(clone)
return 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... // Create a new ig instance with the same data...
// //
// This will reflect the data changes while when the main index is // This will reflect the data changes while when the main index is
// cleared or reloaded this will retain the old data... // 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/', link: ['- System/',
function(){ function(){
var that = this var that = this
var links = this.__links = this.__links || [] var links = this.linked
// 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 link = ImageGridFeatures.setup([...this.features.input, '-ui']) var link = ImageGridFeatures.setup([...this.features.input, '-ui'])
// XXX this is not a clean clone...
return Object.assign( return Object.assign(
link, link,
this) this,
{parent: this})
.run(function(){ .run(function(){
this.logger = that.logger.push(['Task', links.length].join(' ')) this.logger = that.logger.push(['Task', links.length].join(' '))
links.push(this) }) }], links.push(this) }) }],
// XXX this should delete the clone when done...
LinkedTask: ['- System/',
function(){}],
}) })
var Tasks = var Tasks =

View File

@ -856,6 +856,17 @@ var SharpActions = actions.Actions({
return gid }) })], return gid }) })],
cacheAllMetadata: ['- Sharp/Image/', cacheAllMetadata: ['- Sharp/Image/',
'cacheMetadata: "all" ...'], '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==" "integrity": "sha512-4vf7I2LYV/HaWerSo3XmlMkp5eZ83i+/CDluXi/IGTs/O1sejBNhTtnxzmRZfvOUqj7lZjqHkeTvpgSFDlWZTg=="
}, },
"ig-actions": { "ig-actions": {
"version": "3.24.28", "version": "3.24.29",
"resolved": "https://registry.npmjs.org/ig-actions/-/ig-actions-3.24.28.tgz", "resolved": "https://registry.npmjs.org/ig-actions/-/ig-actions-3.24.29.tgz",
"integrity": "sha512-3Um0eHHg15y6bxpLZV+FB88qtBro9iXXHNcoOvOf64I4eu+VPThSe3HBUkw03V81Qv19dSlmNYIPHXU1LcMbRw==", "integrity": "sha512-qfb4zda/cQQ3feOCXO97EOn5i/ac8Zei1CXeiTZlwo+QgtpGdSLC6/pV6Dby+8ikjWLfxVhbd/lK0hBk3g39Jw==",
"requires": { "requires": {
"ig-object": "^5.4.12" "ig-object": "^5.4.12"
} }

View File

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