Support load plugin in node

Relying on `Gun` being globally available is not valid in most cases
where a module loader is being used to import the `load` plugin.
Instead, pull `Gun` from window if window is defined, otherwise require
it using the module loader.
This commit is contained in:
Zee Spencer 2018-02-22 08:52:11 -08:00
parent 16d9a42ff8
commit 5514e00b7a

View File

@ -1,4 +1,8 @@
var Gun = Gun || require('../gun');
if(typeof window !== "undefined"){
var Gun = window.Gun;
} else {
var Gun = require('gun/gun');
}
Gun.chain.open || require('gun/lib/open');
Gun.chain.load = function(cb, opt, at){