diff options
| author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2024-02-18 07:58:59 -0500 | 
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-02-18 12:58:59 +0000 | 
| commit | 7e9f7e2616973418cc50f7706bd8f644cb9d5559 (patch) | |
| tree | 8f8bec7a777a2df33a0a26ef53022c50d2327ef8 /ext/js/application.js | |
| parent | 4aaa9f15d97668203741c1731f15e710ae8b8294 (diff) | |
Application data refactor (#699)
* Pass tabId and frameId to Application
* Remove casts
* Remove redundant frameInformationGet calls
* Expose tabId and frameId
* Remove unsed
* Simplify
* Update FrameAncestryHandler to not need a direct frameId
* Remove frameId from FrameOffsetForwarder
* Remove frameId from PopupFactory
* Remove frameId from Frontend
* Remove frameId from PopupPreviewFrame
* Fix PopupFactory and Frontend constructor
* Remove frameId from Display
* Remove frameId from SearchDisplayController
* Restore if check
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); |