summaryrefslogtreecommitdiff
path: root/ext/js
diff options
context:
space:
mode:
Diffstat (limited to 'ext/js')
-rw-r--r--ext/js/client.js17
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();