Option preference page on install.
This commit is contained in:
parent
e19f955399
commit
14fd0d6514
@ -37,18 +37,24 @@ class Yomichan {
|
|||||||
this.asyncPools = {};
|
this.asyncPools = {};
|
||||||
this.setState('disabled');
|
this.setState('disabled');
|
||||||
|
|
||||||
loadOptions((opts) => {
|
chrome.runtime.onInstalled.addListener(this.onInstalled.bind(this));
|
||||||
this.setOptions(opts);
|
|
||||||
|
|
||||||
chrome.runtime.onMessage.addListener(this.onMessage.bind(this));
|
chrome.runtime.onMessage.addListener(this.onMessage.bind(this));
|
||||||
chrome.browserAction.onClicked.addListener(this.onBrowserAction.bind(this));
|
chrome.browserAction.onClicked.addListener(this.onBrowserAction.bind(this));
|
||||||
|
|
||||||
|
loadOptions((opts) => {
|
||||||
|
this.setOptions(opts);
|
||||||
if (this.options.activateOnStartup) {
|
if (this.options.activateOnStartup) {
|
||||||
this.setState('loading');
|
this.setState('loading');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onInstalled(details) {
|
||||||
|
if (details.reason === 'install') {
|
||||||
|
chrome.runtime.openOptionsPage();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onMessage(request, sender, callback) {
|
onMessage(request, sender, callback) {
|
||||||
const {action, params} = request, method = this['api_' + action];
|
const {action, params} = request, method = this['api_' + action];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user