aboutsummaryrefslogtreecommitdiff
path: root/ext/fg/js/popup.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2020-07-24 17:34:53 -0400
committerGitHub <noreply@github.com>2020-07-24 17:34:53 -0400
commite493cbc998eeee5d3c368287e5c5900c4821bc9d (patch)
tree955e09e9f64116178ec98cfed736434172e0dc75 /ext/fg/js/popup.js
parent3754c920410e90fc6b98aadc9f0dbe60dfa6a14d (diff)
Simplify Popup.showContent API to use only two details arguments (#684)
Diffstat (limited to 'ext/fg/js/popup.js')
-rw-r--r--ext/fg/js/popup.js16
1 files changed, 10 insertions, 6 deletions
diff --git a/ext/fg/js/popup.js b/ext/fg/js/popup.js
index 35e66044..6f2f0a88 100644
--- a/ext/fg/js/popup.js
+++ b/ext/fg/js/popup.js
@@ -133,17 +133,21 @@ class Popup {
return false;
}
- async showContent(elementRect, writingMode, type, details, context) {
+ async showContent(details, displayDetails) {
if (this._options === null) { throw new Error('Options not assigned'); }
- const {optionsContext, source} = context;
- if (source !== this._previousOptionsContextSource) {
+ const {source, optionsContext, elementRect, writingMode} = details;
+ if (typeof source !== 'undefined' && source !== this._previousOptionsContextSource) {
await this.setOptionsContext(optionsContext, source);
}
- await this._show(elementRect, writingMode);
- if (type === null) { return; }
- this._invokeApi('setContent', {type, details});
+ if (typeof elementRect !== 'undefined' && typeof writingMode !== 'undefined') {
+ await this._show(elementRect, writingMode);
+ }
+
+ if (displayDetails !== null) {
+ this._invokeApi('setContent', {type: displayDetails.type, details: displayDetails.details});
+ }
}
setCustomCss(css) {