mirror of
https://github.com/amark/gun.git
synced 2025-06-22 14:02:33 +00:00
merge checks we left out during consolidation
This commit is contained in:
parent
cc4f92f2db
commit
3f12e37ada
10
gun.js
10
gun.js
@ -707,12 +707,16 @@
|
|||||||
if(msg.$$$ && msg.$$$._.id === cat.id){ return } // TODO: Combine this with above so it is less ugly (code aesthetics).
|
if(msg.$$$ && msg.$$$._.id === cat.id){ return } // TODO: Combine this with above so it is less ugly (code aesthetics).
|
||||||
//if(!cat.has && msg.$$$){ return } // TODO: Add safety check for non core chains, like maps?
|
//if(!cat.has && msg.$$$){ return } // TODO: Add safety check for non core chains, like maps?
|
||||||
if('string' != typeof (link = valid(link))){ return }
|
if('string' != typeof (link = valid(link))){ return }
|
||||||
|
var root = cat.root;
|
||||||
|
|
||||||
|
var tat = root.$.get(put['#']).get(put['.'])._;
|
||||||
|
if((tat.echo || (tat.echo = {}))[cat.id] // we've already linked ourselves so we do not need to do it again. Except... (annoying implementation details)
|
||||||
|
&& !(root.pass||'')[cat.id]){ return } // if a new event listener was added, we need to make a pass through for it. The pass will be on the chain, not always the chain passed down.
|
||||||
|
if(tmp = root.pass){ if(tmp[link+cat.id]){ return } tmp[link+cat.id] = 1 } // But the above edge case may "pass through" on a circular graph causing infinite passes, so we hackily add a temporary check for that.
|
||||||
|
|
||||||
var tat = cat.root.$.get(put['#']).get(put['.'])._;
|
|
||||||
if((tat.echo || (tat.echo = {}))[cat.id]){ return } // do not re-link if we have already.
|
|
||||||
(cat.id !== tat.id) && (tat.echo[cat.id] = cat); // set ourselfs up for an echo, but not if to self.
|
(cat.id !== tat.id) && (tat.echo[cat.id] = cat); // set ourselfs up for an echo, but not if to self.
|
||||||
|
|
||||||
var sat = cat.root.$.get(tat.link = link)._; // grab what we're linking to.
|
var sat = root.$.get(tat.link = link)._; // grab what we're linking to.
|
||||||
(sat.echo || (sat.echo = {}))[tat.id] = tat; // link it.
|
(sat.echo || (sat.echo = {}))[tat.id] = tat; // link it.
|
||||||
|
|
||||||
var tmp = cat.ask||''; // ask the chain for what needs to be loaded next!
|
var tmp = cat.ask||''; // ask the chain for what needs to be loaded next!
|
||||||
|
Loading…
x
Reference in New Issue
Block a user