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/popup.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/popup.js')
-rw-r--r-- | ext/fg/js/popup.js | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/ext/fg/js/popup.js b/ext/fg/js/popup.js index 2feb220d..00afb773 100644 --- a/ext/fg/js/popup.js +++ b/ext/fg/js/popup.js @@ -23,15 +23,21 @@ */ class Popup extends EventDispatcher { - constructor(id, depth, frameId, ownerFrameId) { + constructor({ + id, + depth, + frameId, + ownerFrameId, + childrenSupported + }) { super(); this._id = id; this._depth = depth; this._frameId = frameId; this._ownerFrameId = ownerFrameId; + this._childrenSupported = childrenSupported; this._parent = null; this._child = null; - this._childrenSupported = true; this._injectPromise = null; this._injectPromiseComplete = false; this._visible = new DynamicProperty(false); @@ -190,11 +196,8 @@ class Popup extends EventDispatcher { useWebExtensionApi = false; parentNode = this._shadow; } - return await dynamicLoader.loadStyle('yomichan-popup-outer-user-stylesheet', 'code', css, useWebExtensionApi, parentNode); - } - - setChildrenSupported(value) { - this._childrenSupported = value; + const node = await dynamicLoader.loadStyle('yomichan-popup-outer-user-stylesheet', 'code', css, useWebExtensionApi, parentNode); + this.trigger('customOuterCssChanged', {node, useWebExtensionApi}); } getFrameRect() { |