Sv443 1 рік тому
батько
коміт
da8bd439cb
2 змінених файлів з 11 додано та 8 видалено
  1. 11 7
      src/BetterYTM.user.ts
  2. 0 1
      src/features/input.ts

+ 11 - 7
src/BetterYTM.user.ts

@@ -20,6 +20,16 @@ console.log(`Powered by lots of ambition and my song metadata API: ${geniUrlBase
 
 const domain = getDomain();
 
+/** Stuff that needs to be called ASAP, before anything async happens */
+function preInit() {
+  setLogLevel(logLevel);
+
+  if(domain === "ytm")
+    initBeforeUnloadHook();
+
+  init();
+}
+
 async function init() {
   await preInitLayout();
 
@@ -92,10 +102,4 @@ async function onDomLoad() {
   }
 }
 
-// stuff that needs to be called ASAP, before anything async happens
-setLogLevel(logLevel);
-
-if(domain === "ytm")
-  initBeforeUnloadHook();
-
-init();
+preInit();

+ 0 - 1
src/features/input.ts

@@ -65,7 +65,6 @@ function onKeyDown(evt: KeyboardEvent) {
     }
 
     if(!invalidKey) {
-      // TODO: check if the code prop is correct
       const proxyProps = { code: "", ...defaultProps, ...keyProps };
 
       document.body.dispatchEvent(new KeyboardEvent("keydown", proxyProps));