mirror of
https://github.com/amark/gun.git
synced 2025-03-30 15:08:33 +00:00
Check JSON support just once
Two separate modules (localStorage & websockets) ensured JSON was globally defined. Since only one is needed to alert the user, the other has been removed.
This commit is contained in:
parent
bb65acab10
commit
30fe844cab
5
gun.js
5
gun.js
@ -2142,8 +2142,7 @@
|
||||
})(require, './api');
|
||||
|
||||
;require(function(module){
|
||||
if(typeof JSON === 'undefined'){ throw new Error("Include JSON first: ajax.cdnjs.com/ajax/libs/json2/20110223/json2.js") } // for old IE use
|
||||
if(typeof Gun === 'undefined'){ return } // TODO: localStorage is Browser only. But it would be nice if it could somehow plugin into NodeJS compatible localStorage APIs?
|
||||
if(typeof Gun === 'undefined'){ return } // TODO: localStorage is Browser only. But it would be nice if it could somehow plugin into NodeJS compatible localStorage APIs?
|
||||
|
||||
var root, noop = function(){};
|
||||
if(typeof window !== 'undefined'){ root = window }
|
||||
@ -2448,7 +2447,7 @@
|
||||
var peers = gun.Back('opt.peers') || {};
|
||||
|
||||
// Validate.
|
||||
if (Gun.obj.empty(peers) || !WebSocket) {
|
||||
if (Gun.obj.empty(peers)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user