mirror of
https://github.com/amark/gun.git
synced 2025-06-04 05:06:44 +00:00
let NodeJS be a browser-like peer
This commit is contained in:
parent
0b59be0345
commit
402c56d14b
1
gun.js
1
gun.js
@ -545,6 +545,7 @@
|
||||
return valid(v,k,n, at,env);
|
||||
}
|
||||
env.err = "Invalid value at '" + at.path.concat(k).join('.') + "'!";
|
||||
if(Type.list.is(v)){ env.err += " Use `.set(item)` instead of an Array." }
|
||||
}
|
||||
function seen(env, at){
|
||||
var arr = env.seen, i = arr.length, has;
|
||||
|
2
gun.min.js
vendored
2
gun.min.js
vendored
File diff suppressed because one or more lines are too long
@ -61,11 +61,11 @@ Gun.on('opt', function(ctx){
|
||||
}
|
||||
|
||||
opt.WebSocket = opt.WebSocket || WebSocket;
|
||||
var ws = opt.ws || {};
|
||||
ws.server = ws.server || opt.web;
|
||||
|
||||
if(!opt.ws || !opt.ws.web){
|
||||
if(ws.server && !ws.web){
|
||||
|
||||
var ws = opt.ws = opt.ws || {};
|
||||
ws.server = ws.server || opt.web;
|
||||
ws.path = ws.path || '/gun';
|
||||
ws.web = new opt.WebSocket.Server(ws);
|
||||
ws.web.on('connection', function(wire){
|
||||
|
@ -14,8 +14,9 @@ function Dup(opt){
|
||||
if(pass){ it.pass = true }
|
||||
if(!dup.to){
|
||||
dup.to = setTimeout(function(){
|
||||
var now = time_is();
|
||||
Type.obj.map(dup.s, function(it, id){
|
||||
if(opt.age > (time_is() - it.was)){ return }
|
||||
if(opt.age > (now - it.was)){ return }
|
||||
Type.obj.del(dup.s, id);
|
||||
});
|
||||
dup.to = null;
|
||||
|
@ -103,6 +103,7 @@ var Graph = {};
|
||||
return valid(v,k,n, at,env);
|
||||
}
|
||||
env.err = "Invalid value at '" + at.path.concat(k).join('.') + "'!";
|
||||
if(Type.list.is(v)){ env.err += " Use `.set(item)` instead of an Array." }
|
||||
}
|
||||
function seen(env, at){
|
||||
var arr = env.seen, i = arr.length, has;
|
||||
|
Loading…
x
Reference in New Issue
Block a user