forked from nodegui/react-nodegui
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdevtools.ts
More file actions
26 lines (24 loc) · 678 Bytes
/
devtools.ts
File metadata and controls
26 lines (24 loc) · 678 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// import pkg from "../../package.json";
import Reconciler from "../reconciler";
export const initDevtools = (reconciler: typeof Reconciler) => {
let devtools;
try {
const window: any = global;
window.WebSocket = require("ws");
(global as any).window = window;
devtools = require("react-devtools-core");
} catch (e) {
console.log(e);
}
if (devtools) {
const ws = new WebSocket("ws://localhost:8097");
devtools.connectToDevTools({
websocket: ws
});
reconciler.injectIntoDevTools({
bundleType: 1,
version: "0.0.5-alpha", //pkg.version,
rendererPackageName: "@nodegui/react-nodegui" //pkg.name
});
}
};