Files
chrome-extensions-samples/api-samples/alarms/background.js
Sebastian Benz dc2174377a Add prettier and eslint (#831)
* 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
2023-02-22 13:25:39 +01:00

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' });
}