diff --git a/Viewer/features/core.js b/Viewer/features/core.js index 01303338..f974149c 100755 --- a/Viewer/features/core.js +++ b/Viewer/features/core.js @@ -2746,25 +2746,29 @@ function(title, func){ return object.mixin( action = Queued(function(items, ...args){ var that = this + var inputs = [...arguments] // sync start... - if(arguments[0] == 'sync' || arguments[0] == 'async'){ - var [sync, items, ...args] = arguments } + if(inputs[0] == 'sync' || inputs[0] == 'async'){ + var [sync, [items, ...args]] = [inputs.shift(), inputs] } + // XXX see arg_handler(..) note below... var q - var inputs = [items, ...args] - // pre-process args... + // pre-process args (sync)... arg_handler && (inputs = arg_handler.call(this, 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, ...inputs)) // special-case: empty inputs -- no need to handle anything... if(inputs instanceof Array - && inputs[0] - && inputs[0].length == 0){ + && (inputs.length == 0 + || (inputs[0] || []).length == 0)){ return Promise.resolve(inputs) } // Define the runner and prepare... diff --git a/Viewer/features/filesystem.js b/Viewer/features/filesystem.js index 5bb24d7c..9bf55962 100755 --- a/Viewer/features/filesystem.js +++ b/Viewer/features/filesystem.js @@ -858,14 +858,11 @@ var FileSystemLoaderActions = actions.Actions({ _checkIndex: ['File/Check index consistency', // XXX technically this can be a non-session queue, but we'll // need to save the check results... - // XXX update handlers... + // XXX update .handlers to maintain .changes via promise... core.sessionQueueHandler('checkIndex', function(queue, ...args){ // no index loaded... if(!this.location.loaded){ - // XXX should this throw or resolve??? - //throw new Error('.checkIndex(): no index to fix.') } - // XXX test... return [] } // merged 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.') } // get the data... return [Object.entries(this.images), ...args] }, - // XXX test... function([gid, image], ...args){ var updated = false // image .previews... @@ -883,7 +879,6 @@ var FileSystemLoaderActions = actions.Actions({ !fse.existsSync(image.base_path +'/'+ p[1]) && (updated = true) && (delete previews[p[0]]) }) - // XXX do we need this??? Object.keys(previews).length == 0 && (delete image.preview) // image .path...