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

Function findWindow

electron/main.js:26–44  ·  view source on GitHub ↗
(_, port)

Source from the content-addressed store, hash-verified

24const defaultOptions = { iconPath }
25
26const findWindow = async (_, port) => {
27 const browserWindows = BrowserWindow.getAllWindows()
28 const browserWindow = await browserWindows.reduce(async (promise, win) => {
29 const acc = await promise
30 if (acc) return acc
31
32 const { isWorkerRunning, isPortSettingRequired, location } = await checkWindowInfo(win)
33 return (!isWorkerRunning || location.port === port)
34 && !isPortSettingRequired
35 ? win
36 : null
37 }, Promise.resolve(null))
38 if (!browserWindow) createWindow(defaultOptions)
39 if (browserWindow) {
40 if (browserWindow.isMinimized()) browserWindow.restore()
41 browserWindow.focus()
42 }
43 return browserWindow
44}
45
46const handleCommandLine = async (commandLine) => {
47 const url = commandLine.find((arg) => arg.startsWith('rndebugger://'))

Callers

nothing calls this directly

Calls 2

checkWindowInfoFunction · 0.90
createWindowFunction · 0.90

Tested by

no test coverage detected