aboutsummaryrefslogtreecommitdiff
path: root/ext/js/app/popup-proxy.js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/js/app/popup-proxy.js')
-rw-r--r--ext/js/app/popup-proxy.js48
1 files changed, 22 insertions, 26 deletions
diff --git a/ext/js/app/popup-proxy.js b/ext/js/app/popup-proxy.js
index 2821d774..e581be82 100644
--- a/ext/js/app/popup-proxy.js
+++ b/ext/js/app/popup-proxy.js
@@ -140,7 +140,7 @@ export class PopupProxy extends EventDispatcher {
* @returns {Promise<void>}
*/
async setOptionsContext(optionsContext) {
- await this._invokeSafe('PopupFactory.setOptionsContext', {id: this._id, optionsContext}, void 0);
+ await this._invokeSafe('popupFactorySetOptionsContext', {id: this._id, optionsContext}, void 0);
}
/**
@@ -149,7 +149,7 @@ export class PopupProxy extends EventDispatcher {
* @returns {Promise<void>}
*/
async hide(changeFocus) {
- await this._invokeSafe('PopupFactory.hide', {id: this._id, changeFocus}, void 0);
+ await this._invokeSafe('popupFactoryHide', {id: this._id, changeFocus}, void 0);
}
/**
@@ -157,7 +157,7 @@ export class PopupProxy extends EventDispatcher {
* @returns {Promise<boolean>} `true` if the popup is visible, `false` otherwise.
*/
isVisible() {
- return this._invokeSafe('PopupFactory.isVisible', {id: this._id}, false);
+ return this._invokeSafe('popupFactoryIsVisible', {id: this._id}, false);
}
/**
@@ -168,7 +168,7 @@ export class PopupProxy extends EventDispatcher {
* or null if the override wasn't assigned.
*/
setVisibleOverride(value, priority) {
- return this._invokeSafe('PopupFactory.setVisibleOverride', {id: this._id, value, priority}, null);
+ return this._invokeSafe('popupFactorySetVisibleOverride', {id: this._id, value, priority}, null);
}
/**
@@ -177,7 +177,7 @@ export class PopupProxy extends EventDispatcher {
* @returns {Promise<boolean>} `true` if the override existed and was removed, `false` otherwise.
*/
clearVisibleOverride(token) {
- return this._invokeSafe('PopupFactory.clearVisibleOverride', {id: this._id, token}, false);
+ return this._invokeSafe('popupFactoryClearVisibleOverride', {id: this._id, token}, false);
}
/**
@@ -192,7 +192,7 @@ export class PopupProxy extends EventDispatcher {
x += this._frameOffsetX;
y += this._frameOffsetY;
}
- return await this._invokeSafe('PopupFactory.containsPoint', {id: this._id, x, y}, false);
+ return await this._invokeSafe('popupFactoryContainsPoint', {id: this._id, x, y}, false);
}
/**
@@ -212,7 +212,7 @@ export class PopupProxy extends EventDispatcher {
sourceRect.bottom += this._frameOffsetY;
}
}
- await this._invokeSafe('PopupFactory.showContent', {id: this._id, details, displayDetails}, void 0);
+ await this._invokeSafe('popupFactoryShowContent', {id: this._id, details, displayDetails}, void 0);
}
/**
@@ -221,7 +221,7 @@ export class PopupProxy extends EventDispatcher {
* @returns {Promise<void>}
*/
async setCustomCss(css) {
- await this._invokeSafe('PopupFactory.setCustomCss', {id: this._id, css}, void 0);
+ await this._invokeSafe('popupFactorySetCustomCss', {id: this._id, css}, void 0);
}
/**
@@ -229,7 +229,7 @@ export class PopupProxy extends EventDispatcher {
* @returns {Promise<void>}
*/
async clearAutoPlayTimer() {
- await this._invokeSafe('PopupFactory.clearAutoPlayTimer', {id: this._id}, void 0);
+ await this._invokeSafe('popupFactoryClearAutoPlayTimer', {id: this._id}, void 0);
}
/**
@@ -238,7 +238,7 @@ export class PopupProxy extends EventDispatcher {
* @returns {Promise<void>}
*/
async setContentScale(scale) {
- await this._invokeSafe('PopupFactory.setContentScale', {id: this._id, scale}, void 0);
+ await this._invokeSafe('popupFactorySetContentScale', {id: this._id, scale}, void 0);
}
/**
@@ -254,7 +254,7 @@ export class PopupProxy extends EventDispatcher {
* @returns {Promise<void>}
*/
async updateTheme() {
- await this._invokeSafe('PopupFactory.updateTheme', {id: this._id}, void 0);
+ await this._invokeSafe('popupFactoryUpdateTheme', {id: this._id}, void 0);
}
/**
@@ -265,7 +265,7 @@ export class PopupProxy extends EventDispatcher {
* @returns {Promise<void>}
*/
async setCustomOuterCss(css, useWebExtensionApi) {
- await this._invokeSafe('PopupFactory.setCustomOuterCss', {id: this._id, css, useWebExtensionApi}, void 0);
+ await this._invokeSafe('popupFactorySetCustomOuterCss', {id: this._id, css, useWebExtensionApi}, void 0);
}
/**
@@ -282,7 +282,7 @@ export class PopupProxy extends EventDispatcher {
* @returns {Promise<import('popup').ValidSize>} The size and whether or not it is valid.
*/
getFrameSize() {
- return this._invokeSafe('PopupFactory.getFrameSize', {id: this._id}, {width: 0, height: 0, valid: false});
+ return this._invokeSafe('popupFactoryGetFrameSize', {id: this._id}, {width: 0, height: 0, valid: false});
}
/**
@@ -292,32 +292,28 @@ export class PopupProxy extends EventDispatcher {
* @returns {Promise<boolean>} `true` if the size assignment was successful, `false` otherwise.
*/
setFrameSize(width, height) {
- return this._invokeSafe('PopupFactory.setFrameSize', {id: this._id, width, height}, false);
+ return this._invokeSafe('popupFactorySetFrameSize', {id: this._id, width, height}, false);
}
// Private
- // TODO : Type safety
/**
- * @template {import('core').SerializableObject} TParams
- * @template [TReturn=unknown]
- * @param {string} action
- * @param {TParams} params
- * @returns {Promise<TReturn>}
+ * @template {import('cross-frame-api').ApiNames} TName
+ * @param {TName} action
+ * @param {import('cross-frame-api').ApiParams<TName>} params
+ * @returns {Promise<import('cross-frame-api').ApiReturn<TName>>}
*/
_invoke(action, params) {
return yomitan.crossFrame.invoke(this._frameId, action, params);
}
- // TODO : Type safety
/**
- * @template {import('core').SerializableObject} TParams
- * @template [TReturn=unknown]
+ * @template {import('cross-frame-api').ApiNames} TName
* @template [TReturnDefault=unknown]
- * @param {string} action
- * @param {TParams} params
+ * @param {TName} action
+ * @param {import('cross-frame-api').ApiParams<TName>} params
* @param {TReturnDefault} defaultReturnValue
- * @returns {Promise<TReturn|TReturnDefault>}
+ * @returns {Promise<import('cross-frame-api').ApiReturn<TName>|TReturnDefault>}
*/
async _invokeSafe(action, params, defaultReturnValue) {
try {