Defer startup until DOMContentLoaded, in a browser environment

This commit is contained in:
Tony Garnock-Jones 2018-11-03 22:18:15 +00:00
parent 6ae6e4eb82
commit ceff62ff92
1 changed files with 6 additions and 1 deletions

View File

@ -62,7 +62,12 @@ Ground.prototype.addStopHandler = function (h) {
function bootModule(mod) {
let g = new Ground(() => {
Dataspace.activate(mod.exports);
}).start();
});
if (typeof document !== 'undefined') {
document.addEventListener("DOMContentLoaded", (e) => { g.start(); });
} else {
g.start();
}
}
module.exports.Ground = Ground;