We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 57ae4e5 commit 16dfaf2Copy full SHA for 16dfaf2
src/index.ts
@@ -7,7 +7,14 @@ import pageService, { PageState } from "./Services/PageService";
7
import persistenceService from "./Services/PersistenceService";
8
9
console.log("script start");
10
-setTimeout(() => {
+
11
+if (document.location.pathname.length > 1 && 'requestIdleCallback' in window) {
12
+ requestIdleCallback(startup, { timeout: 300000 });
13
+} else {
14
+ setTimeout(startup, 0);
15
+}
16
17
+function startup() {
18
pageService.updateNativeStyleRuleModifications(PageState.LOADING);
19
20
const ytbspComponent = new YTBSPComponent();
@@ -43,4 +50,4 @@ setTimeout(() => {
43
50
pageService.addThumbnailEnlargeCss();
44
51
}).catch(e => console.error(e));
45
52
46
-}, 0);
53
0 commit comments