aboutsummaryrefslogtreecommitdiff
path: root/ext
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-12-15 17:05:50 -0500
committertoasted-nutbread <toasted-nutbread@users.noreply.github.com>2019-12-16 19:54:41 -0500
commit525a3a50d11c282e2b38596dcccc2d6671c0bd63 (patch)
tree6081f491bb4e40df8e81b9aa8735bdf5d2cffa2a /ext
parent2c8c6866eff1656c3ba5a04638534e4c1582739b (diff)
Mark private functions
Diffstat (limited to 'ext')
-rw-r--r--ext/fg/js/popup-proxy-host.js44
1 files changed, 24 insertions, 20 deletions
diff --git a/ext/fg/js/popup-proxy-host.js b/ext/fg/js/popup-proxy-host.js
index e932ae52..c4217307 100644
--- a/ext/fg/js/popup-proxy-host.js
+++ b/ext/fg/js/popup-proxy-host.js
@@ -25,6 +25,8 @@ class PopupProxyHost {
this.frameIdPromise = null;
}
+ // Public functions
+
static create() {
const popupProxyHost = new PopupProxyHost();
popupProxyHost.prepare();
@@ -65,14 +67,6 @@ class PopupProxyHost {
return popup;
}
- getPopup(id) {
- const popup = this.popups.get(id);
- if (typeof popup === 'undefined') {
- throw new Error('Invalid popup ID');
- }
- return popup;
- }
-
// Message handlers
async createNestedPopup(parentId) {
@@ -80,48 +74,58 @@ class PopupProxyHost {
}
async setOptions(id, options) {
- const popup = this.getPopup(id);
+ const popup = this._getPopup(id);
return await popup.setOptions(options);
}
async hide(id, changeFocus) {
- const popup = this.getPopup(id);
+ const popup = this._getPopup(id);
return popup.hide(changeFocus);
}
async isVisibleAsync(id) {
- const popup = this.getPopup(id);
+ const popup = this._getPopup(id);
return await popup.isVisibleAsync();
}
async setVisibleOverride(id, visible) {
- const popup = this.getPopup(id);
+ const popup = this._getPopup(id);
return await popup.setVisibleOverride(visible);
}
async containsPoint(id, x, y) {
- const popup = this.getPopup(id);
+ const popup = this._getPopup(id);
return await popup.containsPoint(x, y);
}
async showContent(id, elementRect, writingMode, type, details) {
- const popup = this.getPopup(id);
- elementRect = PopupProxyHost.convertJsonRectToDOMRect(popup, elementRect);
- if (!PopupProxyHost.popupCanShow(popup)) { return Promise.resolve(false); }
+ const popup = this._getPopup(id);
+ elementRect = PopupProxyHost._convertJsonRectToDOMRect(popup, elementRect);
+ if (!PopupProxyHost._popupCanShow(popup)) { return Promise.resolve(false); }
return await popup.showContent(elementRect, writingMode, type, details);
}
async setCustomCss(id, css) {
- const popup = this.getPopup(id);
+ const popup = this._getPopup(id);
return popup.setCustomCss(css);
}
async clearAutoPlayTimer(id) {
- const popup = this.getPopup(id);
+ const popup = this._getPopup(id);
return popup.clearAutoPlayTimer();
}
- static convertJsonRectToDOMRect(popup, jsonRect) {
+ // Private functions
+
+ _getPopup(id) {
+ const popup = this.popups.get(id);
+ if (typeof popup === 'undefined') {
+ throw new Error('Invalid popup ID');
+ }
+ return popup;
+ }
+
+ static _convertJsonRectToDOMRect(popup, jsonRect) {
let x = jsonRect.x;
let y = jsonRect.y;
if (popup.parent !== null) {
@@ -132,7 +136,7 @@ class PopupProxyHost {
return new DOMRect(x, y, jsonRect.width, jsonRect.height);
}
- static popupCanShow(popup) {
+ static _popupCanShow(popup) {
return popup.parent === null || popup.parent.isVisible();
}
}