1- // import { Bridge } from '../../core/src/bridge'
21import { functions , onRpcConnected } from '@vue/devtools-core'
32import { createRpcClient } from '@vue/devtools-kit'
43import { disconnectDevToolsClient , initDevTools , reloadDevToolsClient } from '../client/devtools-panel'
54
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-
425function init ( ) {
436 injectScript ( chrome . runtime . getURL ( 'dist/user-app.js' ) , ( ) => {
447 initDevTools ( )
@@ -64,6 +27,7 @@ function injectScript(scriptName: string, cb: () => void) {
6427 (function() {
6528 var script = document.constructor.prototype.createElement.call(document, 'script');
6629 script.src = "${ scriptName } ";
30+ script.type = "module";
6731 document.documentElement.appendChild(script);
6832 script.parentNode.removeChild(script);
6933 })()
0 commit comments