merge again

This commit is contained in:
Mark Nadal 2016-11-15 14:40:27 -08:00
parent 6b054146c8
commit 914cce726b
2 changed files with 25 additions and 18 deletions

5
gun.js
View File

@ -926,6 +926,7 @@
} }
function get(at, cat){ function get(at, cat){
var soul = at.get[_soul], node = cat.graph[soul], field = at.get[_field]; var soul = at.get[_soul], node = cat.graph[soul], field = at.get[_field];
console.debug(2, 'GET', soul, node, field);
if(node && (!field || obj_has(node, field))){ if(node && (!field || obj_has(node, field))){
if(field){ if(field){
node = Gun.obj.put({_: node._}, field, node[field]); node = Gun.obj.put({_: node._}, field, node[field]);
@ -947,6 +948,7 @@
if(cat.graph){ if(cat.graph){
Gun.obj.map(at.put, ham, {at: at, cat: cat}); // all unions must happen first, sadly. Gun.obj.map(at.put, ham, {at: at, cat: cat}); // all unions must happen first, sadly.
} }
console.debug(3, 'INPUT', at);
Gun.obj.map(at.put, map, {at: at, cat: cat}); Gun.obj.map(at.put, map, {at: at, cat: cat});
} }
function ham(data, key){ function ham(data, key){
@ -2198,6 +2200,7 @@
Attempted merge with alancnet's `off` support, we'll see if it works. Attempted merge with alancnet's `off` support, we'll see if it works.
*/ */
if(opt !== false){ if(opt !== false){
console.debug(1, 'map!');
ons[ons.length] = gun.on(map, {change: true, as: cat}); ons[ons.length] = gun.on(map, {change: true, as: cat});
} }
} }
@ -2224,6 +2227,8 @@
var gun = this.gun, cat = this.cat, id = this.id; var gun = this.gun, cat = this.cat, id = this.id;
if(cat.list[id+f]){ return } if(cat.list[id+f]){ return }
// TODO: BUG! Ghosting! // TODO: BUG! Ghosting!
console.debug(5, 'EACH', f,v);
console.debug(4, 'EACH', f,v);
return cat.on('in', {gun: (cat.list[id+f] = gun.path(f)), get: f, put: v, via: this.at}); return cat.on('in', {gun: (cat.list[id+f] = gun.path(f)), get: f, put: v, via: this.at});
//return cat.on('in', [id+f, {gun: (cat.list[id+f] = gun.path(f)), get: f, put: v}]); //return cat.on('in', [id+f, {gun: (cat.list[id+f] = gun.path(f)), get: f, put: v}]);
} }

View File

@ -1731,6 +1731,7 @@ describe('Gun', function(){
} }
}, s)}); }, s)});
var check = {}; var check = {};
console.debug.i=1;
(window.FOO = gun.get('u/m/p/n/mutate/n/u').map().path('pet')).on(function(v,f){ (window.FOO = gun.get('u/m/p/n/mutate/n/u').map().path('pet')).on(function(v,f){
check[v.name] = f; check[v.name] = f;
console.log("************", f,v);return; console.log("************", f,v);return;
@ -1744,6 +1745,7 @@ describe('Gun', function(){
},100); },100);
} }
}); });
return;
//gun.get('u/m/p/n/m/n/u/soul').path('alice').path('pet').on(function(v){console.log("?????????????????????????????????????????", v)}) //gun.get('u/m/p/n/m/n/u/soul').path('alice').path('pet').on(function(v){console.log("?????????????????????????????????????????", v)})
setTimeout(function(){ setTimeout(function(){
var s = Gun.state.map();s.soul = 'alice/fuzz/soul'; var s = Gun.state.map();s.soul = 'alice/fuzz/soul';