diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-08-16 16:16:18 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-16 16:16:18 -0400 |
commit | c26c4ae0cb2e8516d79e827e7f76a5974fffdae4 (patch) | |
tree | f4762afe8ac9d5ffc7ada531d8b788274d683ab7 /ext/fg/js/frontend.js | |
parent | 90d694429029d804740d2af384ad903be48b040e (diff) |
Frontend initialization refactor (#737)
* Fix incorrect popup depth reassignment
* Rename variable
* Rename property
* Use explicit parameter values
* Refactor setupNestedPopups
* Refactor frontend initialization
Diffstat (limited to 'ext/fg/js/frontend.js')
-rw-r--r-- | ext/fg/js/frontend.js | 25 |
1 files changed, 12 insertions, 13 deletions
diff --git a/ext/fg/js/frontend.js b/ext/fg/js/frontend.js index 21fbc718..36b1898b 100644 --- a/ext/fg/js/frontend.js +++ b/ext/fg/js/frontend.js @@ -25,7 +25,16 @@ */ class Frontend { - constructor(frameId, popupFactory, frontendInitializationData) { + constructor({ + frameId, + popupFactory, + depth, + parentPopupId, + parentFrameId, + useProxyPopup, + isSearchPage, + allowRootFramePopupProxy + }) { this._id = yomichan.generateId(16); this._popup = null; this._disabledOverride = false; @@ -43,16 +52,7 @@ class Frontend { search: this._search.bind(this), documentUtil: this._documentUtil }); - - const { - depth=0, - id: proxyPopupId, - parentFrameId, - proxy: useProxyPopup=false, - isSearchPage=false, - allowRootFramePopupProxy=true - } = frontendInitializationData; - this._proxyPopupId = proxyPopupId; + this._parentPopupId = parentPopupId; this._parentFrameId = parentFrameId; this._useProxyPopup = useProxyPopup; this._isSearchPage = isSearchPage; @@ -320,7 +320,6 @@ class Frontend { this._textScanner.clearSelection(true); this._popup = popup; - this._depth = popup.depth; } async _getDefaultPopup() { @@ -328,7 +327,7 @@ class Frontend { } async _getProxyPopup() { - const popup = new PopupProxy(null, this._depth + 1, this._proxyPopupId, this._parentFrameId, this._frameId); + const popup = new PopupProxy(null, this._depth, this._parentPopupId, this._parentFrameId, this._frameId); await popup.prepare(); return popup; } |