Skip to content

Instantly share code, notes, and snippets.

View just-jeb's full-sized avatar
🌐
Having fun @ Wix

JeB just-jeb

🌐
Having fun @ Wix
View GitHub Profile
chrome.runtime.onInstalled.addListener(() => {
chrome.storage.sync.set({ color: '#3aa757' });
chrome.webNavigation.onCompleted.addListener(() => {
chrome.tabs.query({ active: true, currentWindow: true }, ([{ id }]) => {
if (id) {
chrome.action.disable(id);
}
});
}, { url: [{ hostContains: 'google.com' }] });
});
{
"name": "Great Extension",
"version": "1.0",
"description": "Build an Extension with Angular",
"manifest_version": 3,
"permissions": [
"activeTab",
"webNavigation",
"storage",
"scripting"
{
"name": "Great Extension",
"version": "1.0",
"description": "Build an Extension with Angular",
"manifest_version": 3,
"permissions": [
"activeTab",
"webNavigation",
"scripting"
],
export class AppComponent implements OnInit {
color = '#ffffff';
public colorize() {
chrome.tabs.query({ active: true, currentWindow: true }, tabs => {
chrome.scripting.executeScript({
target: { tabId: tabs[0].id! },
func: updateBackgroundColor,
args: [this.color]
});
/******/ (() => { // webpackBootstrap
/******/ "use strict";
var __webpack_exports__ = {};
/*!***************************!*\
!*** ./src/background.ts ***!
\***************************/
chrome.runtime.onInstalled.addListener(() => {
// Blah blah the rest of our code
});
import type { Configuration } from 'webpack';
module.exports = {
entry: { background: { import: 'src/background.ts', runtime: false } },
} as Configuration;
{
"name": "Great Extension",
"version": "1.0",
"description": "Build an Extension with Angular",
"manifest_version": 3,
"permissions": [
"activeTab",
"webNavigation"
],
"background": {
chrome.runtime.onInstalled.addListener(() => {
chrome.webNavigation.onCompleted.addListener(() => {
chrome.tabs.query({ active: true, currentWindow: true }, ([{ id }]) => {
if (id) {
chrome.action.disable(id);
}
});
}, { url: [{ hostContains: 'google.com' }] });
});
"architect": {
"build": {
"options": {
...
"optimization": {
"styles": {
"inlineCritical": false
}
}
}
{
"name": "Great Extension",
"version": "1.0",
"description": "Build an Extension with Angular",
"manifest_version": 3,
"action": {
"default_popup": "index.html"
}
}