aboutsummaryrefslogtreecommitdiff
path: root/ext/fg
diff options
context:
space:
mode:
Diffstat (limited to 'ext/fg')
-rw-r--r--ext/fg/js/driver.js9
-rw-r--r--ext/fg/js/util.js8
2 files changed, 16 insertions, 1 deletions
diff --git a/ext/fg/js/driver.js b/ext/fg/js/driver.js
index 68cbcdee..d0907e7d 100644
--- a/ext/fg/js/driver.js
+++ b/ext/fg/js/driver.js
@@ -25,7 +25,7 @@ class Driver {
this.lastTextSource = null;
this.pendingLookup = false;
this.enabled = false;
- this.options = {};
+ this.options = null;
this.definitions = null;
this.sequence = 0;
this.fgRoot = chrome.extension.getURL('fg');
@@ -37,6 +37,13 @@ class Driver {
window.addEventListener('keydown', this.onKeyDown.bind(this));
window.addEventListener('scroll', e => this.hidePopup());
window.addEventListener('resize', e => this.hidePopup());
+
+ getOptions().then(opts => {
+ this.options = opts;
+ return getEnabled();
+ }).then(enabled => {
+ this.enabled = enabled;
+ });
}
onKeyDown(e) {
diff --git a/ext/fg/js/util.js b/ext/fg/js/util.js
index c24ad885..cf5621ec 100644
--- a/ext/fg/js/util.js
+++ b/ext/fg/js/util.js
@@ -21,6 +21,14 @@ function invokeApiBg(action, params) {
return new Promise((resolve, reject) => chrome.runtime.sendMessage({action, params}, resolve));
}
+function getEnabled() {
+ return invokeApiBg('getEnabled', {});
+}
+
+function getOptions() {
+ return invokeApiBg('getOptions', {});
+}
+
function findTerm(text) {
return invokeApiBg('findTerm', {text});
}