some cleanup + minor tweak to .json(..)...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2017-03-04 05:34:53 +03:00
parent ee8df1330f
commit e5f19dfdf3
2 changed files with 15 additions and 12 deletions

View File

@ -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()
}
}

View File

@ -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){