1
- // import { Bridge } from '../../core/src/bridge'
2
1
import { functions , onRpcConnected } from '@vue/devtools-core'
3
2
import { createRpcClient } from '@vue/devtools-kit'
4
3
import { disconnectDevToolsClient , initDevTools , reloadDevToolsClient } from '../client/devtools-panel'
5
4
6
- const connectionInfo : {
7
- retryTimer : NodeJS . Timeout | null
8
- count : number
9
- disconnected : boolean
10
- port : chrome . runtime . Port
11
- listeners : Array < ( ) => void >
12
- } = {
13
- retryTimer : null ,
14
- count : 0 ,
15
- disconnected : false ,
16
- port : null ! ,
17
- listeners : [ ] ,
18
- }
19
-
20
- // function connect() {
21
- // try {
22
- // clearTimeout(connectionInfo.retryTimer!)
23
- // connectionInfo.count++
24
- // connectionInfo.port = chrome.runtime.connect({
25
- // name: `${chrome.devtools.inspectedWindow.tabId}`,
26
- // })
27
-
28
- // connectionInfo.disconnected = false
29
- // connectionInfo.port.onDisconnect.addListener(() => {
30
- // connectionInfo.disconnected = true
31
- // connectionInfo.retryTimer = setTimeout(connect, 1000)
32
- // })
33
- // if (connectionInfo.count > 1)
34
- // connectionInfo.listeners.forEach(fn => connectionInfo.port.onMessage.addListener(fn))
35
- // }
36
- // catch (e) {
37
- // connectionInfo.disconnected = true
38
- // connectionInfo.retryTimer = setTimeout(connect, 5000)
39
- // }
40
- // }
41
-
42
5
function init ( ) {
43
6
injectScript ( chrome . runtime . getURL ( 'dist/user-app.js' ) , ( ) => {
44
7
initDevTools ( )
@@ -64,6 +27,7 @@ function injectScript(scriptName: string, cb: () => void) {
64
27
(function() {
65
28
var script = document.constructor.prototype.createElement.call(document, 'script');
66
29
script.src = "${ scriptName } ";
30
+ script.type = "module";
67
31
document.documentElement.appendChild(script);
68
32
script.parentNode.removeChild(script);
69
33
})()
0 commit comments