Quellcode durchsuchen

refector: rename `injectJSObject` to `inject`, set default root object name to `proginn`

Acathur vor 5 Jahren
Ursprung
Commit
7432113f60
1 geänderte Dateien mit 3 neuen und 5 gelöschten Zeilen
  1. 3 5
      src/bridge/index.ts

+ 3 - 5
src/bridge/index.ts

@@ -54,11 +54,9 @@ class ProginnBridge {
     return payload?.uid
   }
 
-  injectJSObject(name: string, cb: () => void) {
-    // @ts-ignore
-    window.Jishuin = window.Jishuin || {}
-    // @ts-ignore
-    window.Jishuin[name] = cb
+  inject(name: string, cb: () => void, root = 'proginn') {
+    window[root] = window[root] || {}
+    window[root][name] = cb
   }
 
   syncCookies() {