Open guide on install

This commit is contained in:
Alex Yatskov 2016-11-14 21:02:04 -08:00
parent 4e89d27fda
commit 09afc64928

View File

@ -29,6 +29,7 @@ class Yomichan {
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));
chrome.runtime.onInstalled.addListener(this.onInstalled.bind(this));
loadOptions().then(opts => { loadOptions().then(opts => {
this.setOptions(opts); this.setOptions(opts);
@ -38,6 +39,12 @@ class Yomichan {
}); });
} }
onInstalled(details) {
if (details.reason === 'install') {
chrome.tabs.create({url: chrome.extension.getURL('bg/guide.html')});
}
}
onMessage(request, sender, callback) { onMessage(request, sender, callback) {
const {action, params} = request, method = this['api_' + action]; const {action, params} = request, method = this['api_' + action];