mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 10:20:08 +00:00
experimenting...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
f7db0fc878
commit
6235e85f4f
@ -869,22 +869,67 @@ var SharpActions = actions.Actions({
|
|||||||
cacheAllMetadata: ['- Sharp/Image/',
|
cacheAllMetadata: ['- Sharp/Image/',
|
||||||
'cacheMetadata: "all" ...'],
|
'cacheMetadata: "all" ...'],
|
||||||
|
|
||||||
|
|
||||||
// XXX EXPERIMENTAL...
|
// XXX EXPERIMENTAL...
|
||||||
// XXX might be a good idea to rename this to something like:
|
// XXX if we are not careful this may result in some data loss due
|
||||||
// .buildIndex(options)
|
// to unlinking or double edits before save...
|
||||||
// and specify whet to build/not build in options...
|
// (REVISE!!!)
|
||||||
// XXX should we also cache/load metadata here???
|
// XXX it is also possible to save the foreground state while the
|
||||||
// i.e. .cacheAllMetadata()
|
// task is running...
|
||||||
// XXX do we need to think about running this while index is loading???
|
// this should not be destructive unless saving with the exact
|
||||||
makePreviewsAndSave: ['- Sharp|File/',
|
// same timestamp...
|
||||||
function(){
|
// ...this however, if some structure is unlinked, can lead to
|
||||||
var link = this.link()
|
// the later background save shadowing some earlier changes in
|
||||||
return link
|
// the foreground...
|
||||||
.makePreviews(...arguments)
|
// XXX the number of places this can go wrong (see above) warrants a
|
||||||
.then(function(){
|
// rethink...
|
||||||
link.saveIndex
|
// ...can we make .link() work like link-on-demand, i.e. actually
|
||||||
&& link.saveIndex() }) }],
|
// create the link on .clear() but before that use this???
|
||||||
|
// XXX move this to filesystem???
|
||||||
|
makeIndex: ['- File/',
|
||||||
|
core.doc`
|
||||||
|
|
||||||
|
.makeIndex()
|
||||||
|
.makeIndex(options)
|
||||||
|
-> promise
|
||||||
|
|
||||||
|
options format:
|
||||||
|
{
|
||||||
|
// default: true
|
||||||
|
linked: <bool>,
|
||||||
|
|
||||||
|
// default: true
|
||||||
|
metadata: <book> | 'full',
|
||||||
|
|
||||||
|
// default: true
|
||||||
|
previews: <book>,
|
||||||
|
}
|
||||||
|
|
||||||
|
NOTE: this will save the index in the background, this will not affect
|
||||||
|
foreground .changes but will update the foreground data...
|
||||||
|
this will allow modifying stuff while the tasks are running and then
|
||||||
|
saving the changes correctly and allow the user to leave the index...
|
||||||
|
`,
|
||||||
|
function(options={}){
|
||||||
|
var that = options.linked === false ?
|
||||||
|
this
|
||||||
|
: this.link()
|
||||||
|
return Promise.all([
|
||||||
|
// metadata...
|
||||||
|
options.metadata !== false
|
||||||
|
&& ((options.metadata == 'full'
|
||||||
|
&& that.readAllMetadata) ?
|
||||||
|
// full (slow)...
|
||||||
|
that.readAllMetadata())
|
||||||
|
// partial (fast)...
|
||||||
|
: (that.cacheAllMetadata
|
||||||
|
&& that.cacheAllMetadata() ))
|
||||||
|
// previews...
|
||||||
|
options.previews !== false
|
||||||
|
&& that.makePreviews
|
||||||
|
&& that.makePreviews(),
|
||||||
|
// save...
|
||||||
|
]).then(function(){
|
||||||
|
that.saveIndex() }) }],
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user