aboutsummaryrefslogtreecommitdiff
path: root/ext/bg/js/yomichan.js
diff options
context:
space:
mode:
authorAlex Yatskov <alex@foosoft.net>2016-06-03 21:17:55 -0700
committerAlex Yatskov <alex@foosoft.net>2016-06-14 20:44:38 -0700
commit14fd0d65144bd672bcfb9702fdfb96d0963f350b (patch)
tree7c5ae26f2e94f81956a0eba6abb1e146da0152ce /ext/bg/js/yomichan.js
parente19f9553991e59234a63e0275ee4e4f774af8beb (diff)
Option preference page on install.
Diffstat (limited to 'ext/bg/js/yomichan.js')
-rw-r--r--ext/bg/js/yomichan.js14
1 files changed, 10 insertions, 4 deletions
diff --git a/ext/bg/js/yomichan.js b/ext/bg/js/yomichan.js
index 4120dd2b..2c13e8c7 100644
--- a/ext/bg/js/yomichan.js
+++ b/ext/bg/js/yomichan.js
@@ -37,18 +37,24 @@ class Yomichan {
this.asyncPools = {};
this.setState('disabled');
+ chrome.runtime.onInstalled.addListener(this.onInstalled.bind(this));
+ chrome.runtime.onMessage.addListener(this.onMessage.bind(this));
+ chrome.browserAction.onClicked.addListener(this.onBrowserAction.bind(this));
+
loadOptions((opts) => {
this.setOptions(opts);
-
- chrome.runtime.onMessage.addListener(this.onMessage.bind(this));
- chrome.browserAction.onClicked.addListener(this.onBrowserAction.bind(this));
-
if (this.options.activateOnStartup) {
this.setState('loading');
}
});
}
+ onInstalled(details) {
+ if (details.reason === 'install') {
+ chrome.runtime.openOptionsPage();
+ }
+ }
+
onMessage(request, sender, callback) {
const {action, params} = request, method = this['api_' + action];