mirror of
https://github.com/amark/gun.git
synced 2025-03-30 15:08:33 +00:00
commit
9c83766c43
9
gun.js
9
gun.js
@ -629,7 +629,7 @@
|
||||
cb.call(chain, null); // This is in memory success, hardly "success" at all.
|
||||
}
|
||||
if(ctx.field){
|
||||
return gun.back.path(ctx.field, null, {chain: opt.chain || chain});
|
||||
return gun._.back.path(ctx.field, null, {chain: opt.chain || chain});
|
||||
}
|
||||
if(ctx.not){
|
||||
return gun.__.gun.get(ctx.soul, null, {chain: opt.chain || chain});
|
||||
@ -643,13 +643,13 @@
|
||||
} else { // else if we are on an existing chain then...
|
||||
gun._.at('soul').map(put); // put data on every soul that flows through this chain.
|
||||
var back = function(gun){
|
||||
if(back.get || gun.back === gun || gun._.not){ return } // TODO: CLEAN UP! Would be ideal to accomplish this in a more ideal way.
|
||||
if(back.get || gun._.back === gun || gun._.not){ return } // TODO: CLEAN UP! Would be ideal to accomplish this in a more ideal way.
|
||||
if(gun._.get){ back.get = true }
|
||||
gun._.at('null').event(function(at){
|
||||
gun._.at('null').event(function(at){ this.off();
|
||||
if(opt.init || gun.__.opt.init){ return Gun.log("Warning! You have no context to `.put`", val, "!") }
|
||||
gun.init();
|
||||
}, -999);
|
||||
return back(gun.back);
|
||||
return back(gun._.back);
|
||||
};
|
||||
if(!opt.init && !gun.__.opt.init){ back(gun) }
|
||||
}
|
||||
@ -1004,6 +1004,7 @@
|
||||
gun._.at('null').event(function(at){
|
||||
if(!at.not){ return } // TODO: BUG! This check is synchronous but it could be asynchronous!
|
||||
var ctx = {by: gun.__.by(at.soul)};
|
||||
this.off();
|
||||
if(at.field){
|
||||
if(Gun.obj.has(ctx.by.node, at.field)){ return }
|
||||
gun._.at('soul').emit({soul: at.soul, field: at.field, not: true});
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "gun",
|
||||
"version": "0.3.91",
|
||||
"version": "0.3.92",
|
||||
"description": "Graph engine",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
@ -3972,6 +3972,33 @@ describe('Gun', function(){
|
||||
});
|
||||
},100);
|
||||
});
|
||||
|
||||
it("Don't put on parents", function(done){ // TODO: ADD TO 0.5 BRANCH! // Another Stefdv find.
|
||||
var test = gun.get('test');
|
||||
test.path('try.this.at.lvl4').put({msg:'hoi'})
|
||||
test.val(function(node,b){
|
||||
delete node._;
|
||||
expect(Gun.obj.empty(node, 'try')).to.be.ok();
|
||||
node = Gun.obj.copy(gun.__.graph[Gun.is.rel(node.try)]);
|
||||
|
||||
delete node._;
|
||||
expect(Gun.obj.empty(node, 'this')).to.be.ok();
|
||||
node = Gun.obj.copy(gun.__.graph[Gun.is.rel(node.this)]);
|
||||
|
||||
delete node._;
|
||||
expect(Gun.obj.empty(node, 'at')).to.be.ok();
|
||||
node = Gun.obj.copy(gun.__.graph[Gun.is.rel(node.at)]);
|
||||
|
||||
delete node._;
|
||||
expect(Gun.obj.empty(node, 'lvl4')).to.be.ok();
|
||||
node = Gun.obj.copy(gun.__.graph[Gun.is.rel(node.lvl4)]);
|
||||
|
||||
delete node._;
|
||||
expect(Gun.obj.empty(node, 'msg')).to.be.ok();
|
||||
expect(node.msg).to.be('hoi');
|
||||
done();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Streams', function(){
|
||||
|
Loading…
x
Reference in New Issue
Block a user