MCPcopy Create free account
hub / github.com/jhen0409/react-native-debugger / createHandleURLServer

Function createHandleURLServer

electron/url-handle/handleURL.js:58–84  ·  view source on GitHub ↗
(getWindow)

Source from the content-addressed store, hash-verified

56})
57
58const createHandleURLServer = (getWindow) => net
59 .createServer((socket) => {
60 socket.setEncoding('utf-8')
61 socket.on('data', async (data) => {
62 try {
63 const obj = JSON.parse(data)
64 if (typeof obj.path === 'string') {
65 await handleURL(getWindow, obj.path)
66 }
67 socket.write('success')
68 } catch (e) {
69 socket.write('fail')
70 } finally {
71 socket.end()
72 }
73 })
74 })
75 .listen(0, '127.0.0.1')
76 .on('listening', function server() {
77 const { port } = this.address()
78 portfile.write(port)
79 portfile.watchExists(port)
80 process.on('exit', () => portfile.unlink())
81
82 console.log(`Starting listen set-debugger-loc request on port ${port}`)
83 console.log('Will save port to `$HOME/.rndebugger_port` file')
84 })
85
86export default (getWindow) => {
87 // Handle set-debugger-loc for macOS

Callers 1

handleURL.jsFile · 0.85

Calls 1

handleURLFunction · 0.85

Tested by

no test coverage detected