Option preference page on install.

This commit is contained in:
Alex Yatskov 2016-06-03 21:17:55 -07:00
parent e19f955399
commit 14fd0d6514

View File

@ -37,18 +37,24 @@ class Yomichan {
this.asyncPools = {};
this.setState('disabled');
loadOptions((opts) => {
this.setOptions(opts);
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);
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];