diff options
author | Alex Yatskov <alex@foosoft.net> | 2016-09-28 20:14:21 -0700 |
---|---|---|
committer | Alex Yatskov <alex@foosoft.net> | 2016-09-28 20:14:21 -0700 |
commit | 004a0d5281fb1793f9106de06fc6758ff97a48fb (patch) | |
tree | 95e6c50e7e83c800341f4878475c180cfb4756f2 /ext/fg | |
parent | 071902cd057e4828afbc7082271dba1d3ccc1762 (diff) |
Fix activation bug
Diffstat (limited to 'ext/fg')
-rw-r--r-- | ext/fg/js/driver.js | 9 | ||||
-rw-r--r-- | ext/fg/js/util.js | 8 |
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}); } |