mirror of
https://github.com/amark/gun.git
synced 2025-06-05 21:56:51 +00:00
unbuild for @mmalmi 's fix
This commit is contained in:
parent
6246704e11
commit
a0e93717ae
4
gun.min.js
vendored
4
gun.min.js
vendored
File diff suppressed because one or more lines are too long
11
src/get.js
11
src/get.js
@ -61,13 +61,16 @@ function cache(key, back){
|
||||
return at;
|
||||
}
|
||||
function soul(gun, cb, opt, as){
|
||||
var cat = gun._, tmp;
|
||||
var cat = gun._, acks = 0, tmp;
|
||||
if(tmp = cat.soul){ return cb(tmp, as, cat), gun }
|
||||
if(tmp = cat.link){ return cb(tmp, as, cat), gun }
|
||||
gun.get(function(msg, ev){ // TODO: Bug! Needs once semantics?
|
||||
gun.get(function(msg, ev){
|
||||
if(u === msg.put && (tmp = (obj_map(cat.root.opt.peers, function(v,k,t){t(k)})||[]).length) && acks++ <= tmp){
|
||||
return;
|
||||
}
|
||||
ev.rid(msg);
|
||||
var at = ((at = msg.$) && at._) || {};
|
||||
tmp = at.link || at.soul || rel.is(msg.put) || node_soul(msg.put);
|
||||
tmp = at.link || at.soul || rel.is(msg.put) || node_soul(msg.put) || at.dub;
|
||||
cb(tmp, as, msg, ev);
|
||||
}, {out: {get: {'.':true}}});
|
||||
return gun;
|
||||
@ -118,7 +121,7 @@ function rid(at){
|
||||
//obj.del(map, at); // TODO: Warning: This unsubscribes ALL of this chain's listeners from this link, not just the one callback event.
|
||||
return;
|
||||
}
|
||||
var obj = Gun.obj, obj_has = obj.has, obj_to = Gun.obj.to;
|
||||
var obj = Gun.obj, obj_map = obj.map, obj_has = obj.has, obj_to = Gun.obj.to;
|
||||
var num_is = Gun.num.is;
|
||||
var rel = Gun.val.link, node_soul = Gun.node.soul, node_ = Gun.node._;
|
||||
var empty = {}, u;
|
||||
|
@ -30,7 +30,7 @@ Gun.chain.put = function(data, cb, as){
|
||||
});
|
||||
return gun;
|
||||
}
|
||||
as.$ = gun = root.get(as.soul);
|
||||
as.$ = root.get(as.soul);
|
||||
as.ref = as.$;
|
||||
ify(as);
|
||||
return gun;
|
||||
@ -185,8 +185,8 @@ function any(soul, as, msg, eve){
|
||||
as.data = obj_put({}, at.get, as.data);
|
||||
});
|
||||
}
|
||||
tmp = tmp || at.get;
|
||||
at = (at.root.$.get(tmp)._);
|
||||
tmp = tmp || at.soul || at.link || at.dub;// || at.get;
|
||||
at = tmp? (at.root.$.get(tmp)._) : at;
|
||||
as.soul = tmp;
|
||||
data = as.data;
|
||||
}
|
||||
|
@ -4,13 +4,12 @@ Gun.chain.set = function(item, cb, opt){
|
||||
var gun = this, soul;
|
||||
cb = cb || function(){};
|
||||
opt = opt || {}; opt.item = opt.item || item;
|
||||
if(soul = Gun.node.soul(item)){ return gun.set(gun.back(-1).get(soul), cb, opt) }
|
||||
if(soul = Gun.node.soul(item)){ item = Gun.obj.put({}, soul, Gun.val.link.ify(soul)) }
|
||||
if(!Gun.is(item)){
|
||||
var id = gun.back('opt.uuid')();
|
||||
if(id && Gun.obj.is(item)){
|
||||
return gun.set(gun._.root.$.put(item, id), cb, opt);
|
||||
if(Gun.obj.is(item)){;
|
||||
item = gun.back(-1).get(soul = soul || Gun.node.soul(item) || gun.back('opt.uuid')()).put(item);
|
||||
}
|
||||
return gun.get((Gun.state.lex() + Gun.text.random(7))).put(item, cb, opt);
|
||||
return gun.get(soul || (Gun.state.lex() + Gun.text.random(7))).put(item, cb, opt);
|
||||
}
|
||||
item.get(function(soul, o, msg){
|
||||
if(!soul){ return cb.call(gun, {err: Gun.log('Only a node can be linked! Not "' + msg.put + '"!')}) }
|
||||
|
@ -42,7 +42,7 @@ State.ify = function(n, k, s, v, soul){ // put a key's state on a node.
|
||||
return n;
|
||||
}
|
||||
State.to = function(from, k, to){
|
||||
var val = from[k]; // BUGGY!
|
||||
var val = (from||{})[k];
|
||||
if(obj_is(val)){
|
||||
val = obj_copy(val);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user