mirror of
https://github.com/amark/gun.git
synced 2025-06-07 14:46: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);
|
return valid(v,k,n, at,env);
|
||||||
}
|
}
|
||||||
env.err = "Invalid value at '" + at.path.concat(k).join('.') + "'!";
|
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){
|
function seen(env, at){
|
||||||
var arr = env.seen, i = arr.length, has;
|
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;
|
opt.WebSocket = opt.WebSocket || WebSocket;
|
||||||
|
var ws = opt.ws || {};
|
||||||
if(!opt.ws || !opt.ws.web){
|
|
||||||
|
|
||||||
var ws = opt.ws = opt.ws || {};
|
|
||||||
ws.server = ws.server || opt.web;
|
ws.server = ws.server || opt.web;
|
||||||
|
|
||||||
|
if(ws.server && !ws.web){
|
||||||
|
|
||||||
ws.path = ws.path || '/gun';
|
ws.path = ws.path || '/gun';
|
||||||
ws.web = new opt.WebSocket.Server(ws);
|
ws.web = new opt.WebSocket.Server(ws);
|
||||||
ws.web.on('connection', function(wire){
|
ws.web.on('connection', function(wire){
|
||||||
|
@ -14,8 +14,9 @@ function Dup(opt){
|
|||||||
if(pass){ it.pass = true }
|
if(pass){ it.pass = true }
|
||||||
if(!dup.to){
|
if(!dup.to){
|
||||||
dup.to = setTimeout(function(){
|
dup.to = setTimeout(function(){
|
||||||
|
var now = time_is();
|
||||||
Type.obj.map(dup.s, function(it, id){
|
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);
|
Type.obj.del(dup.s, id);
|
||||||
});
|
});
|
||||||
dup.to = null;
|
dup.to = null;
|
||||||
|
@ -103,6 +103,7 @@ var Graph = {};
|
|||||||
return valid(v,k,n, at,env);
|
return valid(v,k,n, at,env);
|
||||||
}
|
}
|
||||||
env.err = "Invalid value at '" + at.path.concat(k).join('.') + "'!";
|
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){
|
function seen(env, at){
|
||||||
var arr = env.seen, i = arr.length, has;
|
var arr = env.seen, i = arr.length, has;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user