forked from MariusBongarts/web-marker-extension
-
Notifications
You must be signed in to change notification settings - Fork 0
/
content.ts
29 lines (19 loc) · 806 Bytes
/
content.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import { WebMarker } from './components/web-marker/src/components/app.component';
import { PopUpComponent } from './components/web-marker/src/components/pop-up/app.component';
const FRONTEND_URL = 'https://web-highlights.com';
// Don´t show extension on FRONTEND_URL
if (!location.href.includes(FRONTEND_URL)) {
const marker = document.createElement("web-marker") as WebMarker;
document.body.appendChild(marker);
const popup = document.createElement("pop-up") as PopUpComponent;
document.body.appendChild(popup);
// Listens for messages from popup in browser action
chrome.runtime.onMessage.addListener(async (request) => {
if (request.id === 'loggedIn') {
await popup.loadUserData();
};
if (request.id === 'loggedOut') {
await popup.logout();
};
});
}