mirror of
https://github.com/GoogleChrome/chrome-extensions-samples.git
synced 2026-03-26 13:19:49 +07:00
* Ignores archived samples * Uses eslint/recommended rules * Runs prettier and eslint (including --fix) pre-commit via husky * Adds new npm scripts: 'lint', 'lint:fix' and 'prettier' * Does not lint inline js code * Fix all prettier and eslint errors * Add custom prettier rules * Apply custom prettier rules * Update readme to explain how to setup the repo * addressed comments
27 lines
675 B
JavaScript
27 lines
675 B
JavaScript
// Copyright 2021 Google LLC
|
|
//
|
|
// Use of this source code is governed by a BSD-style
|
|
// license that can be found in the LICENSE file or at
|
|
// https://developers.google.com/open-source/licenses/bsd
|
|
|
|
// Initialize the demo on install
|
|
chrome.runtime.onInstalled.addListener((reason) => {
|
|
if (reason !== chrome.runtime.OnInstalledReason.INSTALL) {
|
|
return;
|
|
}
|
|
|
|
openDemoTab();
|
|
|
|
// Create an alarm so we have something to look at in the demo
|
|
chrome.alarms.create('demo-default-alarm', {
|
|
delayInMinutes: 1,
|
|
periodInMinutes: 1
|
|
});
|
|
});
|
|
|
|
chrome.action.onClicked.addListener(openDemoTab);
|
|
|
|
function openDemoTab() {
|
|
chrome.tabs.create({ url: 'index.html' });
|
|
}
|