mirror of
https://github.com/amark/gun.git
synced 2025-03-30 15:08:33 +00:00

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.
11 lines
248 B
JavaScript
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);
|
|
} |