From 09afc649283debabc7087ed4242b5c53ea2dfd9a Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Mon, 14 Nov 2016 21:02:04 -0800 Subject: [PATCH] Open guide on install --- ext/bg/js/yomichan.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/ext/bg/js/yomichan.js b/ext/bg/js/yomichan.js index 2b713c02..e8956057 100644 --- a/ext/bg/js/yomichan.js +++ b/ext/bg/js/yomichan.js @@ -29,6 +29,7 @@ class Yomichan { chrome.runtime.onMessage.addListener(this.onMessage.bind(this)); chrome.browserAction.onClicked.addListener(this.onBrowserAction.bind(this)); + chrome.runtime.onInstalled.addListener(this.onInstalled.bind(this)); loadOptions().then(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) { const {action, params} = request, method = this['api_' + action];