debug ts code
This commit is contained in:
21
remote/.vscode/launch.json
vendored
Normal file
21
remote/.vscode/launch.json
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
// Use IntelliSense to learn about possible attributes.
|
||||
// Hover to view descriptions of existing attributes.
|
||||
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"type": "node",
|
||||
"request": "launch",
|
||||
"name": "Launch Program",
|
||||
"program": "${workspaceFolder}/index.ts",
|
||||
"preLaunchTask": "tsc: build - tsconfig.json",
|
||||
},
|
||||
{
|
||||
"type": "node",
|
||||
"request": "attach",
|
||||
"name": "Attach",
|
||||
"port": 9229
|
||||
}
|
||||
]
|
||||
}
|
@@ -8,13 +8,14 @@ var context = vm.createContext(sandbox)
|
||||
wss.on('connection', function connection(ws) {
|
||||
ws.on('message', function incoming(message) {
|
||||
let messageObject = JSON.parse(message)
|
||||
switch(messageObject.cmd) {
|
||||
switch (messageObject.cmd) {
|
||||
case "loadJS":
|
||||
let result = vm.runInContext(messageObject.script, sandbox)
|
||||
ws.send(JSON.stringify({cmd: 'loadJS', result: String(result)}))
|
||||
ws.send(JSON.stringify({ cmd: 'loadJS', result: String(result) }))
|
||||
break
|
||||
case "evaluateJS":
|
||||
break
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
|
Reference in New Issue
Block a user