diff options
| author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2019-12-23 11:59:47 -0500 | 
|---|---|---|
| committer | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2020-01-22 20:38:21 -0500 | 
| commit | 8ef57936d7ab25c723d4da2d655b742cdcf8c84a (patch) | |
| tree | 2a71bd55d374dc7e0e3ee4da95a7a0ebc11ed521 /ext/mixed/js | |
| parent | f6621374817908ec5936caf635bae9bcd20b3ad1 (diff) | |
Add functionality for getting and observing zoom factor
Diffstat (limited to 'ext/mixed/js')
| -rw-r--r-- | ext/mixed/js/api.js | 4 | ||||
| -rw-r--r-- | ext/mixed/js/core.js | 7 | 
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(); |