Browse Source

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

Acathur 5 years ago
parent
commit
7432113f60
1 changed files with 3 additions and 5 deletions
  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() {