summaryrefslogtreecommitdiff
path: root/ext/fg/js/popup.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-12-15 21:40:06 -0500
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-12-16 19:54:41 -0500
commit7c68490d2ea7f106ab79e5bc7ff00b92c95614ff (patch)
treee5528893aaf128294b6a6b267740755ec751b241 /ext/fg/js/popup.js
parent30e13354b3b58a7d7cfce26487076eaaa7552416 (diff)
Add setParent to popup
Diffstat (limited to 'ext/fg/js/popup.js')
-rw-r--r--ext/fg/js/popup.js14
1 files changed, 14 insertions, 0 deletions
diff --git a/ext/fg/js/popup.js b/ext/fg/js/popup.js
index de2c7863..fafc15aa 100644
--- a/ext/fg/js/popup.js
+++ b/ext/fg/js/popup.js
@@ -113,6 +113,20 @@ class Popup {
// Popup-only public functions
+ setParent(parent) {
+ if (parent === null) {
+ throw new Error('Cannot set popup parent to null');
+ }
+ if (this.parent !== null) {
+ throw new Error('Popup already has a parent');
+ }
+ if (parent.child !== null) {
+ throw new Error('Cannot parent popup to another popup which already has a child');
+ }
+ this.parent = parent;
+ parent.child = this;
+ }
+
isVisible() {
return this.isInjected && (this.visibleOverride !== null ? this.visibleOverride : this.visible);
}