aboutsummaryrefslogtreecommitdiff
path: root/ext/fg/js/popup-proxy.js
diff options
context:
space:
mode:
authorsiikamiika <siikamiika@users.noreply.github.com>2020-04-26 22:33:50 +0300
committerGitHub <noreply@github.com>2020-04-26 22:33:50 +0300
commitca033a87a0d302151b430acfdf9d480514c14aed (patch)
treeebb783c7bd371a6859c25009a57799d70ac73bac /ext/fg/js/popup-proxy.js
parenta49e4ccc4e5c7defb30bd88535c18137acf9812c (diff)
Update Popup and DisplayFloat optionsContext from Frontend (#464)
* set optionsContext from Frontend * update Popup+Display options on Frontend change * remove popup setOptions * only update DisplayFloat options from Frontend * fix optionsContext usage * fix preview frame arguments * keep Frontend URL up to date * cache url * fix preview frame * trigger modifyingProfileChange in correct places * remove async from function not using await * refactor optionsContext in Frontend
Diffstat (limited to 'ext/fg/js/popup-proxy.js')
-rw-r--r--ext/fg/js/popup-proxy.js19
1 files changed, 9 insertions, 10 deletions
diff --git a/ext/fg/js/popup-proxy.js b/ext/fg/js/popup-proxy.js
index 3af83db2..cd3c1bc9 100644
--- a/ext/fg/js/popup-proxy.js
+++ b/ext/fg/js/popup-proxy.js
@@ -20,12 +20,11 @@
*/
class PopupProxy {
- constructor(id, depth, parentId, parentFrameId, url, getFrameOffset=null, setDisabled=null) {
+ constructor(id, depth, parentId, parentFrameId, getFrameOffset=null, setDisabled=null) {
this._parentId = parentId;
this._parentFrameId = parentFrameId;
this._id = id;
this._depth = depth;
- this._url = url;
this._apiSender = new FrontendApiSender();
this._getFrameOffset = getFrameOffset;
this._setDisabled = setDisabled;
@@ -49,10 +48,6 @@ class PopupProxy {
return this._depth;
}
- get url() {
- return this._url;
- }
-
// Public functions
async prepare() {
@@ -64,8 +59,8 @@ class PopupProxy {
return true;
}
- async setOptions(options) {
- return await this._invokeHostApi('setOptions', {id: this._id, options});
+ async setOptionsContext(optionsContext, source) {
+ return await this._invokeHostApi('setOptionsContext', {id: this._id, optionsContext, source});
}
hide(changeFocus) {
@@ -88,14 +83,14 @@ class PopupProxy {
return await this._invokeHostApi('containsPoint', {id: this._id, x, y});
}
- async showContent(elementRect, writingMode, type=null, details=null) {
+ async showContent(elementRect, writingMode, type, details, context) {
let {x, y, width, height} = elementRect;
if (this._getFrameOffset !== null) {
await this._updateFrameOffset();
[x, y] = this._applyFrameOffset(x, y);
}
elementRect = {x, y, width, height};
- return await this._invokeHostApi('showContent', {id: this._id, elementRect, writingMode, type, details});
+ return await this._invokeHostApi('showContent', {id: this._id, elementRect, writingMode, type, details, context});
}
async setCustomCss(css) {
@@ -110,6 +105,10 @@ class PopupProxy {
this._invokeHostApi('setContentScale', {id: this._id, scale});
}
+ async getHostUrl() {
+ return await this._invokeHostApi('getHostUrl', {});
+ }
+
// Private
_invokeHostApi(action, params={}) {