mirror of
https://github.com/amark/gun.git
synced 2025-06-11 00:26:45 +00:00
call sub chains clear/empty OK!
This commit is contained in:
parent
e16f982ee8
commit
cc1a03e6d2
3
gun.js
3
gun.js
@ -691,8 +691,9 @@
|
||||
if(!cat.soul && !msg.$$){
|
||||
if(
|
||||
(cat.link !== null || (root.pass||'')[cat.id]) &&
|
||||
//cat.link !== u && // TODO: BUG? actually this should be if link as a property exists or not.
|
||||
(((root.pass||'')[cat.id] && cat.link !== u && cat.ask['']) || // fire again if we have a pass but be careful not to fire if we do not have the node fully loaded yet.
|
||||
(('string' != typeof (tmp = valid(change))) || (cat.link && tmp != cat.link)) // any time there is a change in value that is different from the previous link in any way, we need to fire a clear/empty event on chains below. // However! Do this only when unique, and make sure to do it with performance in mind.
|
||||
)
|
||||
){
|
||||
cat.link = null;
|
||||
cat.next && setTimeout.each(Object.keys(cat.ask||''), function(get, sat){ // TODO: Bug? If we're a map do we want to clear out everything, wouldn't it just be the one item's subchains, not all?
|
||||
|
@ -2937,14 +2937,15 @@ describe('Gun', function(){
|
||||
}, 'parallel', function(){
|
||||
gun.get('parallel').get('bob').get('age').get(function(at, ev){
|
||||
var err = at.err, data = at.put, field = at.get;
|
||||
//console.log("***** age", data, field, at.$._.ack, '...', at);//return;
|
||||
//console.log("*****", field, data);return;
|
||||
expect(data).to.be(29);
|
||||
expect(field).to.be('age');
|
||||
done.age = true;
|
||||
});
|
||||
//console.log("-----------------------");
|
||||
gun.get('parallel').get('bob').get('name').get(function(at, ev){
|
||||
var err = at.err, data = at.put, field = at.get;
|
||||
//console.log("*********** name", data, at.$._.ack);//return;
|
||||
//console.log("***********", field, data);return;
|
||||
expect(data).to.be('Bob!');
|
||||
expect(field).to.be('name');
|
||||
done.name = true;
|
||||
@ -3530,7 +3531,7 @@ describe('Gun', function(){
|
||||
}, 1000);
|
||||
});
|
||||
|
||||
it.only('Chain on known nested object should ack', function(done){
|
||||
it('Chain on known nested object should ack', function(done){
|
||||
Gun.statedisk({ bar: { wat: 1 } }, 'nl/app', function(){
|
||||
var gun = Gun(), u;
|
||||
var app = gun.get('nl/app').get('bar');
|
||||
@ -3538,7 +3539,7 @@ describe('Gun', function(){
|
||||
app.get(function(d){
|
||||
//d = (d.$$||d.$)._.put;
|
||||
if(!d || !d.put || !d.put.wat){ return }
|
||||
console.log('should be called: {wat:1}=', d.put);
|
||||
//console.log('should be called: {wat:1}=', d.put);
|
||||
expect(d.put.wat).to.be(1);
|
||||
done.a = 1;
|
||||
if(!done.u){ return }
|
||||
@ -3547,9 +3548,9 @@ describe('Gun', function(){
|
||||
done();
|
||||
});//, {v2020:1});
|
||||
|
||||
console.log("----------");
|
||||
//console.log("----------");
|
||||
app.get('a').get('b').get(function(d){
|
||||
console.log("empty/clear: undefined=", d.put);
|
||||
//console.log("empty/clear: undefined=", d.put);
|
||||
//d = (d.$$||d.$)._.put;
|
||||
expect(d.put).to.be(u);
|
||||
done.u = true;
|
||||
@ -3580,7 +3581,7 @@ describe('Gun', function(){
|
||||
|
||||
});
|
||||
|
||||
it('users map map who said map on', function(done){
|
||||
it.only('users map map who said map on', function(done){
|
||||
this.timeout(1000 * 9);
|
||||
var gun = Gun();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user