From e493cbc998eeee5d3c368287e5c5900c4821bc9d Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Fri, 24 Jul 2020 17:34:53 -0400 Subject: Simplify Popup.showContent API to use only two details arguments (#684) --- ext/fg/js/popup.js | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'ext/fg/js/popup.js') 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) { -- cgit v1.2.3