updated examples!

This commit is contained in:
Mark Nadal 2017-03-28 01:15:39 -07:00
parent 7453d858a4
commit d5d2454e14
6 changed files with 12 additions and 8 deletions

View File

@ -62,7 +62,7 @@
</div>
</form>
<div class="model">
<li class="white huet2 box"><div class="when"></div><b class="who"></b><p class="what"></p><span class="sort none">0</span></li>
<li class="white huet2 box"><b class="who"></b><p class="what"></p><span class="sort none">0</span><div class="when"></div></li>
</div>
</div>
</div>

2
gun.min.js vendored

File diff suppressed because one or more lines are too long

View File

@ -58,7 +58,7 @@ var Graph = {};
if(!(is = valid(v,f,n, at,env))){ return }
if(!f){
at.node = at.node || n || {};
if(obj_has(v, Node._)){
if(obj_has(v, Node._) && !Gun.is(v)){
at.node._ = obj_copy(v._);
}
at.node = Node.soul.ify(at.node, Val.rel.is(at.rel));

View File

@ -32,8 +32,10 @@ Gun.on('out', function(at){
if(!cat.udrain){ return }
var tmp = cat.udrain;
cat.udrain = null;
message = JSON.stringify(tmp);
Gun.obj.map(cat.opt.peers, send, cat);
if( tmp.length ) {
message = JSON.stringify(tmp);
Gun.obj.map(cat.opt.peers, send, cat);
}
},1);
wsp.count = 0;
Gun.obj.map(cat.opt.peers, send, cat);
@ -70,7 +72,7 @@ function receive(msg, peer, cat){
function open(peer, as){
if(!peer || !peer.url){ return }
var url = peer.url.replace('http', 'ws');
var wire = peer.wire = new WebSocket(url);
var wire = peer.wire = new WebSocket(url, as.opt.wsc.protocols, as.opt.wsc );
wire.onclose = function(){
reconnect(peer, as);
};

View File

@ -132,6 +132,7 @@ Gun._ = { // some reserved key words, these are not the only ones.
if(!obj_is(at.opt.peers)){ at.opt.peers = {}}
at.opt.peers = obj_to(tmp, at.opt.peers);
}
at.opt.wsc = at.opt.wsc || {protocols:null}
at.opt.peers = at.opt.peers || {};
obj_to(opt, at.opt); // copies options on to `at.opt` only if not already taken.
Gun.on('opt', at);

View File

@ -9,13 +9,14 @@ function State(){
t = time();
}
if(last < t){
return N = 0, last = t;
return N = 0, last = t + State.drift;
}
return last = t + ((N += 1) / D);
return last = t + ((N += 1) / D) + State.drift;
}
var time = Type.time.is, last = -Infinity, N = 0, D = 1000; // WARNING! In the future, on machines that are D times faster than 2016AD machines, you will want to increase D by another several orders of magnitude so the processing speed never out paces the decimal resolution (increasing an integer effects the state accuracy).
var perf = (typeof performance !== 'undefined')? (performance.timing && performance) : false, start = (perf && perf.timing && perf.timing.navigationStart) || (perf = false);
State._ = '>';
State.drift = 0;
State.ify = function(n, f, s, v, soul){ // put a field's state on a node.
if(!n || !n[N_]){ // reject if it is not node-like.
if(!soul){ // unless they passed a soul