From 5d9bbcd713668dc2ab551eb5f24c492e2883169b Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Fri, 13 May 2016 01:09:58 +0300 Subject: [PATCH] cleanup... Signed-off-by: Alex A. Naanou --- ui (gen4)/file.js | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/ui (gen4)/file.js b/ui (gen4)/file.js index 8bc2fa23..4bd23dde 100755 --- a/ui (gen4)/file.js +++ b/ui (gen4)/file.js @@ -35,17 +35,11 @@ var INDEX_DIR = '.ImageGrid' -/*********************************************************************/ -// Queue -// -// Task -// - - - /*********************************************************************/ // helpers... +// Skip nested indexes from tree... +// var skipNested = function(paths, index_dir, logger){ paths = paths .map(function(p){ return p.split(index_dir).shift() }) @@ -91,14 +85,17 @@ function(glob){ return guaranteeEvents('match end', glob) } var gGlob = module.gGlob = function(){ - return guaranteeGlobEvents(glob.apply(null, arguments)) -} + return guaranteeGlobEvents(glob.apply(null, arguments)) } /*********************************************************************/ // Reader... +// XXX would be nice to find a way to stop searching a sub tree as soon +// as a match is found. +// ...this would be allot faster than getting the whole tree and +// then pruning through like it is done now... var listIndexes = module.listIndexes = function(base, index_dir){ @@ -116,6 +113,9 @@ function(base, index_dir, logger){ .on('error', function(err){ reject(err) }) + .on('match', function(path){ + logger && logger.emit('found', path) + }) .on('end', function(paths){ // skip nested indexes... resolve(skipNested(paths, index_dir, logger)) @@ -677,7 +677,6 @@ function(){ } - // Build a data and images objects from the json returned by loadIndex(..) // // Contrary to loadIndex(..) this expects a specific format of data: @@ -937,7 +936,6 @@ function(json, path, date, filename_tpl, logger){ - /********************************************************************** * vim:set ts=4 sw=4 : */ return module })