diff options
Diffstat (limited to 'ext/js/application.js')
-rw-r--r-- | ext/js/application.js | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/ext/js/application.js b/ext/js/application.js index d7ab6725..7a2f216c 100644 --- a/ext/js/application.js +++ b/ext/js/application.js @@ -108,7 +108,6 @@ export class Application extends EventDispatcher { * @type {API} */ get api() { - if (this._api === null) { throw new Error('Not prepared'); } return this._api; } @@ -118,11 +117,24 @@ export class Application extends EventDispatcher { * @type {CrossFrameAPI} */ get crossFrame() { - if (this._crossFrame === null) { throw new Error('Not prepared'); } return this._crossFrame; } /** + * @type {?number} + */ + get tabId() { + return this._crossFrame.tabId; + } + + /** + * @type {?number} + */ + get frameId() { + return this._crossFrame.frameId; + } + + /** * Prepares the instance for use. */ prepare() { @@ -157,7 +169,7 @@ export class Application extends EventDispatcher { const webExtension = new WebExtension(); const api = new API(webExtension); await this.waitForBackendReady(webExtension); - const {tabId = null, frameId = null} = await api.frameInformationGet(); + const {tabId, frameId} = await api.frameInformationGet(); const crossFrameApi = new CrossFrameAPI(api, tabId, frameId); crossFrameApi.prepare(); const application = new Application(api, crossFrameApi); |