summaryrefslogtreecommitdiff
path: root/ext/js/app
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-11-21 15:54:58 -0500
committerGitHub <noreply@github.com>2021-11-21 15:54:58 -0500
commit005f9658d98143ea1189482ae627405c8bf5a566 (patch)
tree712732685dd3300ad9403f17d2937486e3835661 /ext/js/app
parent06e70c1cd8a6e23b54ba9081caf82902820ceccd (diff)
Action handler name disambiguation (#2018)
* Disambiguate PopupFactory action handlers * Update HotkeyHandler action names * Disambiguate Frontend action handlers * Disambiguate Display action handlers * Disambiguate PopupPreviewFrame action handlers * Disambiguate Yomichan action handlers * Disambiguate Frontend action handlers * Disambiguate Display action handlers * Disambiguate SearchDisplayController action handlers
Diffstat (limited to 'ext/js/app')
-rw-r--r--ext/js/app/frontend.js22
-rw-r--r--ext/js/app/popup-factory.js32
-rw-r--r--ext/js/app/popup-proxy.js28
-rw-r--r--ext/js/app/popup-window.js8
-rw-r--r--ext/js/app/popup.js16
5 files changed, 53 insertions, 53 deletions
diff --git a/ext/js/app/frontend.js b/ext/js/app/frontend.js
index 0f72e06b..3b482ad2 100644
--- a/ext/js/app/frontend.js
+++ b/ext/js/app/frontend.js
@@ -92,9 +92,9 @@ class Frontend {
this._optionsContextOverride = null;
this._runtimeMessageHandlers = new Map([
- ['requestFrontendReadyBroadcast', {async: false, handler: this._onMessageRequestFrontendReadyBroadcast.bind(this)}],
- ['setAllVisibleOverride', {async: true, handler: this._onApiSetAllVisibleOverride.bind(this)}],
- ['clearAllVisibleOverride', {async: true, handler: this._onApiClearAllVisibleOverride.bind(this)}]
+ ['Frontend.requestReadyBroadcast', {async: false, handler: this._onMessageRequestFrontendReadyBroadcast.bind(this)}],
+ ['Frontend.setAllVisibleOverride', {async: true, handler: this._onApiSetAllVisibleOverride.bind(this)}],
+ ['Frontend.clearAllVisibleOverride', {async: true, handler: this._onApiClearAllVisibleOverride.bind(this)}]
]);
this._hotkeyHandler.registerActions([
@@ -159,11 +159,11 @@ class Frontend {
this._textScanner.on('searched', this._onSearched.bind(this));
yomichan.crossFrame.registerHandlers([
- ['closePopup', {async: false, handler: this._onApiClosePopup.bind(this)}],
- ['copySelection', {async: false, handler: this._onApiCopySelection.bind(this)}],
- ['getSelectionText', {async: false, handler: this._onApiGetSelectionText.bind(this)}],
- ['getPopupInfo', {async: false, handler: this._onApiGetPopupInfo.bind(this)}],
- ['getPageInfo', {async: false, handler: this._onApiGetPageInfo.bind(this)}]
+ ['Frontend.closePopup', {async: false, handler: this._onApiClosePopup.bind(this)}],
+ ['Frontend.copySelection', {async: false, handler: this._onApiCopySelection.bind(this)}],
+ ['Frontend.getSelectionText', {async: false, handler: this._onApiGetSelectionText.bind(this)}],
+ ['Frontend.getPopupInfo', {async: false, handler: this._onApiGetPopupInfo.bind(this)}],
+ ['Frontend.getPageInfo', {async: false, handler: this._onApiGetPageInfo.bind(this)}]
]);
this._updateContentScale();
@@ -509,7 +509,7 @@ class Frontend {
return await this._getDefaultPopup();
}
- const {popupId} = await yomichan.crossFrame.invoke(targetFrameId, 'getPopupInfo');
+ const {popupId} = await yomichan.crossFrame.invoke(targetFrameId, 'Frontend.getPopupInfo');
if (popupId === null) {
return null;
}
@@ -702,7 +702,7 @@ class Frontend {
}
chrome.runtime.onMessage.addListener(onMessage);
- yomichan.api.broadcastTab('requestFrontendReadyBroadcast', {frameId: this._frameId});
+ yomichan.api.broadcastTab('Frontend.requestReadyBroadcast', {frameId: this._frameId});
});
}
@@ -728,7 +728,7 @@ class Frontend {
let documentTitle = document.title;
if (this._useProxyPopup) {
try {
- ({url, documentTitle} = await yomichan.crossFrame.invoke(this._parentFrameId, 'getPageInfo', {}));
+ ({url, documentTitle} = await yomichan.crossFrame.invoke(this._parentFrameId, 'Frontend.getPageInfo', {}));
} catch (e) {
// NOP
}
diff --git a/ext/js/app/popup-factory.js b/ext/js/app/popup-factory.js
index 95587162..126f229c 100644
--- a/ext/js/app/popup-factory.js
+++ b/ext/js/app/popup-factory.js
@@ -43,21 +43,21 @@ class PopupFactory {
prepare() {
this._frameOffsetForwarder.prepare();
yomichan.crossFrame.registerHandlers([
- ['getOrCreatePopup', {async: true, handler: this._onApiGetOrCreatePopup.bind(this)}],
- ['setOptionsContext', {async: true, handler: this._onApiSetOptionsContext.bind(this)}],
- ['hide', {async: false, handler: this._onApiHide.bind(this)}],
- ['isVisible', {async: true, handler: this._onApiIsVisibleAsync.bind(this)}],
- ['setVisibleOverride', {async: true, handler: this._onApiSetVisibleOverride.bind(this)}],
- ['clearVisibleOverride', {async: true, handler: this._onApiClearVisibleOverride.bind(this)}],
- ['containsPoint', {async: true, handler: this._onApiContainsPoint.bind(this)}],
- ['showContent', {async: true, handler: this._onApiShowContent.bind(this)}],
- ['setCustomCss', {async: false, handler: this._onApiSetCustomCss.bind(this)}],
- ['clearAutoPlayTimer', {async: false, handler: this._onApiClearAutoPlayTimer.bind(this)}],
- ['setContentScale', {async: false, handler: this._onApiSetContentScale.bind(this)}],
- ['updateTheme', {async: false, handler: this._onApiUpdateTheme.bind(this)}],
- ['setCustomOuterCss', {async: false, handler: this._onApiSetCustomOuterCss.bind(this)}],
- ['popup.getFrameSize', {async: true, handler: this._onApiGetFrameSize.bind(this)}],
- ['popup.setFrameSize', {async: true, handler: this._onApiSetFrameSize.bind(this)}]
+ ['PopupFactory.getOrCreatePopup', {async: true, handler: this._onApiGetOrCreatePopup.bind(this)}],
+ ['PopupFactory.setOptionsContext', {async: true, handler: this._onApiSetOptionsContext.bind(this)}],
+ ['PopupFactory.hide', {async: false, handler: this._onApiHide.bind(this)}],
+ ['PopupFactory.isVisible', {async: true, handler: this._onApiIsVisibleAsync.bind(this)}],
+ ['PopupFactory.setVisibleOverride', {async: true, handler: this._onApiSetVisibleOverride.bind(this)}],
+ ['PopupFactory.clearVisibleOverride', {async: true, handler: this._onApiClearVisibleOverride.bind(this)}],
+ ['PopupFactory.containsPoint', {async: true, handler: this._onApiContainsPoint.bind(this)}],
+ ['PopupFactory.showContent', {async: true, handler: this._onApiShowContent.bind(this)}],
+ ['PopupFactory.setCustomCss', {async: false, handler: this._onApiSetCustomCss.bind(this)}],
+ ['PopupFactory.clearAutoPlayTimer', {async: false, handler: this._onApiClearAutoPlayTimer.bind(this)}],
+ ['PopupFactory.setContentScale', {async: false, handler: this._onApiSetContentScale.bind(this)}],
+ ['PopupFactory.updateTheme', {async: false, handler: this._onApiUpdateTheme.bind(this)}],
+ ['PopupFactory.setCustomOuterCss', {async: false, handler: this._onApiSetCustomOuterCss.bind(this)}],
+ ['PopupFactory.getFrameSize', {async: true, handler: this._onApiGetFrameSize.bind(this)}],
+ ['PopupFactory.setFrameSize', {async: true, handler: this._onApiSetFrameSize.bind(this)}]
]);
}
@@ -149,7 +149,7 @@ class PopupFactory {
throw new Error('Invalid frameId');
}
const useFrameOffsetForwarder = (parentPopupId === null);
- ({id, depth, frameId} = await yomichan.crossFrame.invoke(frameId, 'getOrCreatePopup', {
+ ({id, depth, frameId} = await yomichan.crossFrame.invoke(frameId, 'PopupFactory.getOrCreatePopup', {
id,
parentPopupId,
frameId,
diff --git a/ext/js/app/popup-proxy.js b/ext/js/app/popup-proxy.js
index 3e95ff2a..7d9d41b0 100644
--- a/ext/js/app/popup-proxy.js
+++ b/ext/js/app/popup-proxy.js
@@ -129,7 +129,7 @@ class PopupProxy extends EventDispatcher {
* @returns {Promise<void>}
*/
setOptionsContext(optionsContext) {
- return this._invokeSafe('setOptionsContext', {id: this._id, optionsContext});
+ return this._invokeSafe('PopupFactory.setOptionsContext', {id: this._id, optionsContext});
}
/**
@@ -138,7 +138,7 @@ class PopupProxy extends EventDispatcher {
* @returns {Promise<void>}
*/
hide(changeFocus) {
- return this._invokeSafe('hide', {id: this._id, changeFocus});
+ return this._invokeSafe('PopupFactory.hide', {id: this._id, changeFocus});
}
/**
@@ -146,7 +146,7 @@ class PopupProxy extends EventDispatcher {
* @returns {Promise<boolean>} `true` if the popup is visible, `false` otherwise.
*/
isVisible() {
- return this._invokeSafe('isVisible', {id: this._id}, false);
+ return this._invokeSafe('PopupFactory.isVisible', {id: this._id}, false);
}
/**
@@ -157,7 +157,7 @@ class PopupProxy extends EventDispatcher {
* or null if the override wasn't assigned.
*/
setVisibleOverride(value, priority) {
- return this._invokeSafe('setVisibleOverride', {id: this._id, value, priority}, null);
+ return this._invokeSafe('PopupFactory.setVisibleOverride', {id: this._id, value, priority}, null);
}
/**
@@ -166,7 +166,7 @@ class PopupProxy extends EventDispatcher {
* @returns {Promise<boolean>} `true` if the override existed and was removed, `false` otherwise.
*/
clearVisibleOverride(token) {
- return this._invokeSafe('clearVisibleOverride', {id: this._id, token}, false);
+ return this._invokeSafe('PopupFactory.clearVisibleOverride', {id: this._id, token}, false);
}
/**
@@ -180,7 +180,7 @@ class PopupProxy extends EventDispatcher {
await this._updateFrameOffset();
[x, y] = this._applyFrameOffset(x, y);
}
- return await this._invokeSafe('containsPoint', {id: this._id, x, y}, false);
+ return await this._invokeSafe('PopupFactory.containsPoint', {id: this._id, x, y}, false);
}
/**
@@ -195,7 +195,7 @@ class PopupProxy extends EventDispatcher {
await this._updateFrameOffset();
[elementRect.x, elementRect.y] = this._applyFrameOffset(elementRect.x, elementRect.y);
}
- return await this._invokeSafe('showContent', {id: this._id, details, displayDetails});
+ return await this._invokeSafe('PopupFactory.showContent', {id: this._id, details, displayDetails});
}
/**
@@ -204,7 +204,7 @@ class PopupProxy extends EventDispatcher {
* @returns {Promise<void>}
*/
setCustomCss(css) {
- return this._invokeSafe('setCustomCss', {id: this._id, css});
+ return this._invokeSafe('PopupFactory.setCustomCss', {id: this._id, css});
}
/**
@@ -212,7 +212,7 @@ class PopupProxy extends EventDispatcher {
* @returns {Promise<void>}
*/
clearAutoPlayTimer() {
- return this._invokeSafe('clearAutoPlayTimer', {id: this._id});
+ return this._invokeSafe('PopupFactory.clearAutoPlayTimer', {id: this._id});
}
/**
@@ -221,7 +221,7 @@ class PopupProxy extends EventDispatcher {
* @returns {Promise<void>}
*/
setContentScale(scale) {
- return this._invokeSafe('setContentScale', {id: this._id, scale});
+ return this._invokeSafe('PopupFactory.setContentScale', {id: this._id, scale});
}
/**
@@ -238,7 +238,7 @@ class PopupProxy extends EventDispatcher {
* @returns {Promise<void>}
*/
updateTheme() {
- return this._invokeSafe('updateTheme', {id: this._id});
+ return this._invokeSafe('PopupFactory.updateTheme', {id: this._id});
}
/**
@@ -249,7 +249,7 @@ class PopupProxy extends EventDispatcher {
* @returns {Promise<void>}
*/
setCustomOuterCss(css, useWebExtensionApi) {
- return this._invokeSafe('setCustomOuterCss', {id: this._id, css, useWebExtensionApi});
+ return this._invokeSafe('PopupFactory.setCustomOuterCss', {id: this._id, css, useWebExtensionApi});
}
/**
@@ -266,7 +266,7 @@ class PopupProxy extends EventDispatcher {
* @returns {Promise<{width: number, height: number, valid: boolean}>} The size and whether or not it is valid.
*/
getFrameSize() {
- return this._invokeSafe('popup.getFrameSize', {id: this._id}, {width: 0, height: 0, valid: false});
+ return this._invokeSafe('PopupFactory.getFrameSize', {id: this._id}, {width: 0, height: 0, valid: false});
}
/**
@@ -276,7 +276,7 @@ class PopupProxy extends EventDispatcher {
* @returns {Promise<boolean>} `true` if the size assignment was successful, `false` otherwise.
*/
setFrameSize(width, height) {
- return this._invokeSafe('popup.setFrameSize', {id: this._id, width, height});
+ return this._invokeSafe('PopupFactory.setFrameSize', {id: this._id, width, height});
}
// Private
diff --git a/ext/js/app/popup-window.js b/ext/js/app/popup-window.js
index 8f1a8355..e84b050a 100644
--- a/ext/js/app/popup-window.js
+++ b/ext/js/app/popup-window.js
@@ -117,7 +117,7 @@ class PopupWindow extends EventDispatcher {
* @returns {Promise<void>}
*/
setOptionsContext(optionsContext) {
- return this._invoke(false, 'setOptionsContext', {id: this._id, optionsContext});
+ return this._invoke(false, 'Display.setOptionsContext', {id: this._id, optionsContext});
}
/**
@@ -174,7 +174,7 @@ class PopupWindow extends EventDispatcher {
*/
async showContent(_details, displayDetails) {
if (displayDetails === null) { return; }
- await this._invoke(true, 'setContent', {id: this._id, details: displayDetails});
+ await this._invoke(true, 'Display.setContent', {id: this._id, details: displayDetails});
}
/**
@@ -182,14 +182,14 @@ class PopupWindow extends EventDispatcher {
* @param {string} css The CSS rules.
*/
setCustomCss(css) {
- return this._invoke(false, 'setCustomCss', {id: this._id, css});
+ return this._invoke(false, 'Display.setCustomCss', {id: this._id, css});
}
/**
* Stops the audio auto-play timer, if one has started.
*/
clearAutoPlayTimer() {
- return this._invoke(false, 'clearAutoPlayTimer', {id: this._id});
+ return this._invoke(false, 'Display.clearAutoPlayTimer', {id: this._id});
}
/**
diff --git a/ext/js/app/popup.js b/ext/js/app/popup.js
index 8454dcb1..acaf6e15 100644
--- a/ext/js/app/popup.js
+++ b/ext/js/app/popup.js
@@ -161,7 +161,7 @@ class Popup extends EventDispatcher {
*/
async setOptionsContext(optionsContext) {
await this._setOptionsContext(optionsContext);
- await this._invokeSafe('setOptionsContext', {optionsContext});
+ await this._invokeSafe('Display.setOptionsContext', {optionsContext});
}
/**
@@ -245,7 +245,7 @@ class Popup extends EventDispatcher {
}
if (displayDetails !== null) {
- this._invokeSafe('setContent', {details: displayDetails});
+ this._invokeSafe('Display.setContent', {details: displayDetails});
}
}
@@ -254,14 +254,14 @@ class Popup extends EventDispatcher {
* @param {string} css The CSS rules.
*/
setCustomCss(css) {
- this._invokeSafe('setCustomCss', {css});
+ this._invokeSafe('Display.setCustomCss', {css});
}
/**
* Stops the audio auto-play timer, if one has started.
*/
clearAutoPlayTimer() {
- this._invokeSafe('clearAutoPlayTimer');
+ this._invokeSafe('Display.clearAutoPlayTimer');
}
/**
@@ -271,7 +271,7 @@ class Popup extends EventDispatcher {
setContentScale(scale) {
this._contentScale = scale;
this._frame.style.fontSize = `${scale}px`;
- this._invokeSafe('setContentScale', {scale});
+ this._invokeSafe('Display.setContentScale', {scale});
}
/**
@@ -411,7 +411,7 @@ class Popup extends EventDispatcher {
await frameClient.connect(this._frame, this._targetOrigin, this._frameId, setupFrame);
// Configure
- await this._invokeSafe('configure', {
+ await this._invokeSafe('Display.configure', {
depth: this._depth,
parentPopupId: this._id,
parentFrameId: this._frameId,
@@ -569,7 +569,7 @@ class Popup extends EventDispatcher {
if (this._visibleValue === value) { return; }
this._visibleValue = value;
this._frame.style.setProperty('visibility', value ? 'visible' : 'hidden', 'important');
- this._invokeSafe('visibilityChanged', {value});
+ this._invokeSafe('Display.visibilityChanged', {value});
}
_focusParent() {
@@ -627,7 +627,7 @@ class Popup extends EventDispatcher {
}
_onExtensionUnloaded() {
- this._invokeWindow('extensionUnloaded');
+ this._invokeWindow('Display.extensionUnloaded');
}
_getFrameParentElement() {