From e5f19dfdf38c93a728281c1fb9f8370ff83733a4 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sat, 4 Mar 2017 05:34:53 +0300 Subject: [PATCH] some cleanup + minor tweak to .json(..)... Signed-off-by: Alex A. Naanou --- ui (gen4)/features/base.js | 16 ++++++++++------ ui (gen4)/features/peer.js | 11 +++++------ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/ui (gen4)/features/base.js b/ui (gen4)/features/base.js index c5377dbb..1e9f82fe 100755 --- a/ui (gen4)/features/base.js +++ b/ui (gen4)/features/base.js @@ -246,18 +246,22 @@ actions.Actions({ {journal: true}, function(lst, base){ this.load(this.dataFromURLs(lst, base)) }], - // XXX experimental... - // ...the bad thing about this is that we can not extend this, - // adding new items to the resulting structure... // XXX is this the correct way to go??? // ...can we save simple attribute values??? json: ['- File/Dump state as JSON object', - 'This will collect JSON data from every available attribute ' - +'supporting the .dumpJSON() method.', + core.doc`Dump state as JSON object + + This will collect JSON data from every available attribute supporting + the .dumpJSON() method. + + NOTE: this will ignore attributes starting with '__'. + `, function(mode){ var res = {} for(var k in this){ - if(this[k] != null && this[k].dumpJSON != null){ + if(!k.startsWith('__') + && this[k] != null + && this[k].dumpJSON != null){ res[k] = this[k].dumpJSON() } } diff --git a/ui (gen4)/features/peer.js b/ui (gen4)/features/peer.js index 11eacfdf..a264681c 100755 --- a/ui (gen4)/features/peer.js +++ b/ui (gen4)/features/peer.js @@ -216,7 +216,11 @@ var PeerActions = actions.Actions({ })], peerCall: ['- Peer/', - function(id, action){ return new CooperativePromise() }], + //function(id, action){ return new CooperativePromise() }], + function(id, action){ + var args = [].slice.call(arguments, 2) + return this.peerApply(id, action, args) + }], peerApply: ['- Peer/', function(id, action, args){ return new CooperativePromise() }], @@ -338,11 +342,6 @@ var ChildProcessPeerActions = actions.Actions({ // ...this would be useful to 100% match the action api and // make the thing transparent... // XXX prop access??? - peerCall: ['- Peer/', - makeProtocolHandler('child', function(id, action){ - var args = [].slice.call(arguments, 2) - return this.peerApply(id, action, args) - })], peerApply: ['- Peer/', makeProtocolHandler('child', function(id, action, args){ return new Promise((function(resolve, reject){