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');
|
||||||
|
|
||||||
|
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) => {
|
loadOptions((opts) => {
|
||||||
this.setOptions(opts);
|
this.setOptions(opts);
|
||||||
|
|
||||||
chrome.runtime.onMessage.addListener(this.onMessage.bind(this));
|
|
||||||
chrome.browserAction.onClicked.addListener(this.onBrowserAction.bind(this));
|
|
||||||
|
|
||||||
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