aboutsummaryrefslogtreecommitdiff
path: root/ext/mixed
diff options
context:
space:
mode:
Diffstat (limited to 'ext/mixed')
-rw-r--r--ext/mixed/js/api.js4
-rw-r--r--ext/mixed/js/core.js7
2 files changed, 10 insertions, 1 deletions
diff --git a/ext/mixed/js/api.js b/ext/mixed/js/api.js
index 9f0835b0..5ec93b01 100644
--- a/ext/mixed/js/api.js
+++ b/ext/mixed/js/api.js
@@ -105,6 +105,10 @@ function apiGetDisplayTemplatesHtml() {
return _apiInvoke('getDisplayTemplatesHtml');
}
+function apiGetZoom() {
+ return _apiInvoke('getZoom');
+}
+
function _apiInvoke(action, params={}) {
const data = {action, params};
return new Promise((resolve, reject) => {
diff --git a/ext/mixed/js/core.js b/ext/mixed/js/core.js
index 7fc01c94..0142d594 100644
--- a/ext/mixed/js/core.js
+++ b/ext/mixed/js/core.js
@@ -244,7 +244,8 @@ const yomichan = (() => {
this._messageHandlers = new Map([
['getUrl', this._onMessageGetUrl.bind(this)],
- ['optionsUpdate', this._onMessageOptionsUpdate.bind(this)]
+ ['optionsUpdate', this._onMessageOptionsUpdate.bind(this)],
+ ['zoomChanged', this._onMessageZoomChanged.bind(this)]
]);
chrome.runtime.onMessage.addListener(this._onMessage.bind(this));
@@ -274,6 +275,10 @@ const yomichan = (() => {
_onMessageOptionsUpdate({source}) {
this.trigger('optionsUpdate', {source});
}
+
+ _onMessageZoomChanged({oldZoomFactor, newZoomFactor}) {
+ this.trigger('zoomChanged', {oldZoomFactor, newZoomFactor});
+ }
}
return new Yomichan();