diff options
author | Alex Yatskov <alex@foosoft.net> | 2016-04-05 22:18:55 -0700 |
---|---|---|
committer | Alex Yatskov <alex@foosoft.net> | 2016-04-05 22:18:55 -0700 |
commit | 721a4dc661fe85768ebdb57b7d4caa5f9c485372 (patch) | |
tree | 74224c9138e91f34d720f3e9815cae1da291affe /ext/js | |
parent | 8774c783f6cb3e72e837ad335f78df0ca08f24e5 (diff) |
WIP
Diffstat (limited to 'ext/js')
-rw-r--r-- | ext/js/client.js | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/ext/js/client.js b/ext/js/client.js index 2d9a470f..2c513187 100644 --- a/ext/js/client.js +++ b/ext/js/client.js @@ -22,6 +22,7 @@ class Client { this.popupOffset = 10; this.lastMosePos = null; this.enabled = false; + this.options = null; this.popup = document.createElement('div'); this.popup.classList.add('yomichan-popup'); @@ -61,8 +62,16 @@ class Client { } } - onMessage(request, sender, callback) { - this.setEnabled(request === 'enabled'); + onMessage({name, value}, sender, callback) { + switch (name) { + case 'state': + this.setEnabled(value === 'enabled'); + break; + case 'options': + this.setOptions(value); + break; + } + callback(); } @@ -117,6 +126,10 @@ class Client { this.hidePopup(); } } + + setOptions(opts) { + this.options = opts; + } } window.yomiClient = new Client(); |