kibana/x-pack/test_utils/chrome_extension/test_subjects_finder/background.js
2019-12-13 23:17:13 -07:00

28 lines
938 B
JavaScript

/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
/* eslint-disable no-undef */
chrome.runtime.onInstalled.addListener(function() {
chrome.storage.sync.set({ outputType: 'typescript' });
chrome.declarativeContent.onPageChanged.removeRules(undefined, () => {
// Only activate the plugin on localhost
chrome.declarativeContent.onPageChanged.addRules([
{
conditions: [
new chrome.declarativeContent.PageStateMatcher({
pageUrl: { hostEquals: 'localhost' },
}),
new chrome.declarativeContent.PageStateMatcher({
pageUrl: { hostEquals: 'kibana-dev' },
}),
],
actions: [new chrome.declarativeContent.ShowPageAction()],
},
]);
});
});