gun/lib/load.js
Zee Spencer 5514e00b7a 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.
2018-02-22 08:52:11 -08:00

11 lines
248 B
JavaScript

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){
(opt = opt || {}).off = !0;
return this.open(cb, opt, at);
}