From 5ce24233abb3866af72928998a78d0c14fadd0dc Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sat, 4 May 2019 21:07:30 +0300 Subject: [PATCH] experimenting with walker construction... Signed-off-by: Alex A. Naanou --- ui (gen4)/lib/widget/browse2.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/ui (gen4)/lib/widget/browse2.js b/ui (gen4)/lib/widget/browse2.js index 973202de..b535faa0 100755 --- a/ui (gen4)/lib/widget/browse2.js +++ b/ui (gen4)/lib/widget/browse2.js @@ -252,6 +252,18 @@ var makeItemEventMethod = function(event, handler){ }) } +var makeWalker = function(name, func, options){ + return function(...args){ + // XXX do we get passed options?? + return this.walk2( + func, + function(children){ + return children[name](...args) }, + function(node){ + return node && node[name] instanceof Function }, + options || {}) } } + + // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -1026,6 +1038,13 @@ var BaseBrowserPrototype = { && [ (options || {}).joinPaths !== false ? p.join('/') : p ] }, options) }, + // XXX need to be able to update context (i.e. path) ... + paths3: makeWalker('path3', + function(n, i, p){ + return n + && [ (options || {}).joinPaths !== false ? + p.join('/') + : p ] }), // Extended map...