-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontent_script.js
More file actions
27 lines (23 loc) · 943 Bytes
/
Copy pathcontent_script.js
File metadata and controls
27 lines (23 loc) · 943 Bytes
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
/**
* GitHub Mentions+ content bootstrap
*/
const contentScriptRoot = typeof window !== 'undefined' ? window : globalThis;
const app = contentScriptRoot.GitHubMentionsContent?.createApp
? contentScriptRoot.GitHubMentionsContent.createApp()
: null;
if (app) {
if (document.readyState === 'loading') {
document.addEventListener('DOMContentLoaded', () => app.initialize());
} else {
app.initialize();
}
document.addEventListener('visibilitychange', () => app.handleVisibilityChange());
document.addEventListener('focusin', (event) => app.handleFocusIn(event), true);
window.addEventListener('resize', () => app.handleResize());
window.addEventListener('scroll', () => app.handleScroll(), true);
window.addEventListener('beforeunload', () => app.cleanup());
chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
app.handleMessage(message, sender, sendResponse);
return true;
});
}