mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 10:20:08 +00:00
testing ._checkIndex(..), tweaks, and cleanup...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
6d678abd87
commit
26650d63fe
@ -2746,25 +2746,29 @@ function(title, func){
|
|||||||
return object.mixin(
|
return object.mixin(
|
||||||
action = Queued(function(items, ...args){
|
action = Queued(function(items, ...args){
|
||||||
var that = this
|
var that = this
|
||||||
|
var inputs = [...arguments]
|
||||||
|
|
||||||
// sync start...
|
// sync start...
|
||||||
if(arguments[0] == 'sync' || arguments[0] == 'async'){
|
if(inputs[0] == 'sync' || inputs[0] == 'async'){
|
||||||
var [sync, items, ...args] = arguments }
|
var [sync, [items, ...args]] = [inputs.shift(), inputs] }
|
||||||
|
|
||||||
|
// XXX see arg_handler(..) note below...
|
||||||
var q
|
var q
|
||||||
var inputs = [items, ...args]
|
|
||||||
|
|
||||||
// pre-process args...
|
// pre-process args (sync)...
|
||||||
arg_handler
|
arg_handler
|
||||||
&& (inputs = arg_handler.call(this,
|
&& (inputs = arg_handler.call(this,
|
||||||
sync == 'sync' ?
|
sync == 'sync' ?
|
||||||
sync
|
sync
|
||||||
|
// XXX should this be a queue???
|
||||||
|
// ...seems like this is either 'sync' or
|
||||||
|
// undefined but never a queue at this stage...
|
||||||
: q,
|
: q,
|
||||||
...inputs))
|
...inputs))
|
||||||
// special-case: empty inputs -- no need to handle anything...
|
// special-case: empty inputs -- no need to handle anything...
|
||||||
if(inputs instanceof Array
|
if(inputs instanceof Array
|
||||||
&& inputs[0]
|
&& (inputs.length == 0
|
||||||
&& inputs[0].length == 0){
|
|| (inputs[0] || []).length == 0)){
|
||||||
return Promise.resolve(inputs) }
|
return Promise.resolve(inputs) }
|
||||||
|
|
||||||
// Define the runner and prepare...
|
// Define the runner and prepare...
|
||||||
|
|||||||
@ -858,14 +858,11 @@ var FileSystemLoaderActions = actions.Actions({
|
|||||||
_checkIndex: ['File/Check index consistency',
|
_checkIndex: ['File/Check index consistency',
|
||||||
// XXX technically this can be a non-session queue, but we'll
|
// XXX technically this can be a non-session queue, but we'll
|
||||||
// need to save the check results...
|
// need to save the check results...
|
||||||
// XXX update handlers...
|
// XXX update .handlers to maintain .changes via promise...
|
||||||
core.sessionQueueHandler('checkIndex',
|
core.sessionQueueHandler('checkIndex',
|
||||||
function(queue, ...args){
|
function(queue, ...args){
|
||||||
// no index loaded...
|
// no index loaded...
|
||||||
if(!this.location.loaded){
|
if(!this.location.loaded){
|
||||||
// XXX should this throw or resolve???
|
|
||||||
//throw new Error('.checkIndex(): no index to fix.') }
|
|
||||||
// XXX test...
|
|
||||||
return [] }
|
return [] }
|
||||||
// merged index...
|
// merged index...
|
||||||
// XXX can we remove this restriction -- i.e. check each index...
|
// XXX can we remove this restriction -- i.e. check each index...
|
||||||
@ -873,7 +870,6 @@ var FileSystemLoaderActions = actions.Actions({
|
|||||||
throw new Error('.checkIndex(): combined indexes not supported.') }
|
throw new Error('.checkIndex(): combined indexes not supported.') }
|
||||||
// get the data...
|
// get the data...
|
||||||
return [Object.entries(this.images), ...args] },
|
return [Object.entries(this.images), ...args] },
|
||||||
// XXX test...
|
|
||||||
function([gid, image], ...args){
|
function([gid, image], ...args){
|
||||||
var updated = false
|
var updated = false
|
||||||
// image .previews...
|
// image .previews...
|
||||||
@ -883,7 +879,6 @@ var FileSystemLoaderActions = actions.Actions({
|
|||||||
!fse.existsSync(image.base_path +'/'+ p[1])
|
!fse.existsSync(image.base_path +'/'+ p[1])
|
||||||
&& (updated = true)
|
&& (updated = true)
|
||||||
&& (delete previews[p[0]]) })
|
&& (delete previews[p[0]]) })
|
||||||
// XXX do we need this???
|
|
||||||
Object.keys(previews).length == 0
|
Object.keys(previews).length == 0
|
||||||
&& (delete image.preview)
|
&& (delete image.preview)
|
||||||
// image .path...
|
// image .path...
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user