Explorar el Código

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

Acathur hace 5 años
padre
commit
7432113f60
Se han modificado 1 ficheros con 3 adiciones y 5 borrados
  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() {