Skip to content

Commit

Permalink
Update index.js
Browse files Browse the repository at this point in the history
  • Loading branch information
lutzroeder committed May 5, 2023
1 parent 0bdeade commit 061989f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions source/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,14 @@ host.BrowserHost = class {
}
}

static create() {
const value = new host.BrowserHost();
const preload = (ids) => Promise.all(ids.map((id) => value.require(id)));
create() {
const preload = (ids) => Promise.all(ids.map((id) => this.require(id)));
return preload([ 'base', 'text', 'flatbuffers', 'flexbuffers', 'zip', 'tar', 'python', 'dagre' ]).then(() => {
return preload([ 'json', 'xml', 'protobuf', 'hdf5', 'grapher' ]).then(() => {
return preload([ 'view' ]).then(() => value);
return preload([ 'view' ]);
});
}).catch((error) => {
value._terminate(error.message);
this._terminate(error.message);
});
}

Expand Down Expand Up @@ -842,9 +841,10 @@ if (window.location.hostname.endsWith('.github.io')) {
throw new Error("Module '" + id + "' not found.");
};
window.addEventListener('load', () => {
host.BrowserHost.create().then((host) => {
const value = new host.BrowserHost();
value.create().then(() => {
const view = require('./view');
window.__view__ = new view.View(host);
window.__view__ = new view.View(value);
});
});
}

0 comments on commit 061989f

Please sign in to comment.