Merge pull request #376 from swhgoon/patch-1

load Gun once in NW.js's JavaScript Contexts
This commit is contained in:
Mark Nadal 2017-06-06 11:31:25 -06:00 committed by GitHub
commit b92a91b76a

6
nts.js
View File

@ -2,8 +2,10 @@
var env;
if(typeof global !== "undefined"){ env = global }
if(typeof require !== "undefined"){ var Gun = require('./gun') }
if(typeof window !== "undefined"){ var Gun = (env = window).Gun }
else {
if(typeof require !== "undefined"){ var Gun = require('./gun') }
}
Gun.on('opt', function(at){
this.to.next(at);
@ -43,4 +45,4 @@
}; ping();
});
// test by opening up examples/game/nts.html on devices that aren't NTP synced.
}());
}());