diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-11-23 15:23:47 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-23 15:23:47 -0500 |
commit | 01ff7436ee381c4414e95572cff08aac999b7721 (patch) | |
tree | cf5fc7fffdcec77f7dc3996ece0d35b227c9f8c6 /ext/fg/js/frontend.js | |
parent | 2971f262f9851d588f815d5ea03de69f9594de5a (diff) |
Popup setup refactoring (#1054)
* Pass childrenSupported as a parameter to Frontend/Popup constructors
* Remove setChildrenSupported
* Use event listener instead of function override
* Update options order
* Expand options and use object for clarity
* Fix childrenSupported not being fully propagated
Diffstat (limited to 'ext/fg/js/frontend.js')
-rw-r--r-- | ext/fg/js/frontend.js | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/ext/fg/js/frontend.js b/ext/fg/js/frontend.js index e4c6342e..6ae3b06d 100644 --- a/ext/fg/js/frontend.js +++ b/ext/fg/js/frontend.js @@ -24,15 +24,25 @@ class Frontend { constructor({ - frameId, + pageType, popupFactory, depth, + frameId, parentPopupId, parentFrameId, useProxyPopup, - pageType, - allowRootFramePopupProxy + allowRootFramePopupProxy, + childrenSupported=true }) { + this._pageType = pageType; + this._popupFactory = popupFactory; + this._depth = depth; + this._frameId = frameId; + this._parentPopupId = parentPopupId; + this._parentFrameId = parentFrameId; + this._useProxyPopup = useProxyPopup; + this._allowRootFramePopupProxy = allowRootFramePopupProxy; + this._childrenSupported = childrenSupported; this._popup = null; this._disabledOverride = false; this._options = null; @@ -49,14 +59,6 @@ class Frontend { searchTerms: true, searchKanji: true }); - this._parentPopupId = parentPopupId; - this._parentFrameId = parentFrameId; - this._useProxyPopup = useProxyPopup; - this._pageType = pageType; - this._depth = depth; - this._frameId = frameId; - this._popupFactory = popupFactory; - this._allowRootFramePopupProxy = allowRootFramePopupProxy; this._popupCache = new Map(); this._popupEventListeners = new EventListenerCollection(); this._updatePopupToken = null; @@ -398,7 +400,8 @@ class Frontend { return await this._popupFactory.getOrCreatePopup({ frameId: this._frameId, ownerFrameId: this._frameId, - depth: this._depth + depth: this._depth, + childrenSupported: this._childrenSupported }); } @@ -407,7 +410,8 @@ class Frontend { frameId: this._parentFrameId, ownerFrameId: this._frameId, depth: this._depth, - parentPopupId: this._parentPopupId + parentPopupId: this._parentPopupId, + childrenSupported: this._childrenSupported }); } @@ -428,7 +432,8 @@ class Frontend { const popup = await this._popupFactory.getOrCreatePopup({ frameId: targetFrameId, ownerFrameId: this._frameId, - id: popupId + id: popupId, + childrenSupported: this._childrenSupported }); popup.on('offsetNotFound', () => { this._allowRootFramePopupProxy = false; @@ -441,7 +446,8 @@ class Frontend { return await this._popupFactory.getOrCreatePopup({ ownerFrameId: this._frameId, depth: this._depth, - popupWindow: true + popupWindow: true, + childrenSupported: this._childrenSupported }); } |