From 30fe844cab5168a3097445136f927868c783fc95 Mon Sep 17 00:00:00 2001 From: Jesse Gibson Date: Mon, 12 Dec 2016 16:10:39 -0700 Subject: [PATCH] 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. --- gun.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/gun.js b/gun.js index efea12bf..18aba562 100644 --- a/gun.js +++ b/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; }