diff --git a/source/index.js b/source/index.js index 479f899f73..26ed6e265a 100644 --- a/source/index.js +++ b/source/index.js @@ -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); }); } @@ -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); }); }); }