MCPcopy Create free account
hub / github.com/DarkGuy10/BotClient / createMainWindow

Function createMainWindow

public/electron.js:38–79  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

36let client = null
37
38function createMainWindow() {
39 mainWindow = new BrowserWindow({
40 width: 800,
41 height: 600,
42 icon: path.join(__dirname, 'icon.png'),
43 webPreferences: {
44 nodeIntegration: true,
45 contextIsolation: false,
46 },
47 })
48
49 mainWindow.loadURL(
50 isDev
51 ? 'http://localhost:3000'
52 : `file://${path.join(__dirname, '../build/index.html')}`
53 )
54 mainWindow.maximize()
55 mainWindow.setMenu(null)
56
57 mainWindow.webContents.on('will-navigate', (event, url) => {
58 if (
59 url ===
60 (isDev
61 ? 'http://localhost:3000/'
62 : `file://${path.join(__dirname, '../build/index.html')}`)
63 )
64 return
65 console.log(url)
66 event.preventDefault()
67 shell.openExternal(url)
68 })
69
70 mainWindow.on('closed', () => {
71 mainWindow = null
72 })
73
74 if (isDev) {
75 const devTools = new BrowserWindow()
76 mainWindow.webContents.setDevToolsWebContents(devTools.webContents)
77 mainWindow.webContents.openDevTools({ mode: 'detach' })
78 }
79}
80
81app.on('ready', () => {
82 // Startup code if any goes here...

Callers 1

electron.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected