mirror of
https://github.com/GoogleChrome/chrome-extensions-samples.git
synced 2026-04-04 14:49:44 +07:00
20 lines
689 B
JavaScript
20 lines
689 B
JavaScript
// Copyright 2018 The Chromium Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
'use strict';
|
|
|
|
chrome.runtime.onInstalled.addListener(function() {
|
|
chrome.storage.sync.set({color: '#3aa757'}, function() {
|
|
console.log('The color is green.');
|
|
});
|
|
chrome.declarativeContent.onPageChanged.removeRules(undefined, function() {
|
|
chrome.declarativeContent.onPageChanged.addRules([{
|
|
conditions: [new chrome.declarativeContent.PageStateMatcher({
|
|
pageUrl: {hostEquals: 'developer.chrome.com'},
|
|
})],
|
|
actions: [new chrome.declarativeContent.ShowPageAction()]
|
|
}]);
|
|
});
|
|
});
|