MCPcopy
hub / github.com/diego3g/rocketredis / createWindow

Function createWindow

electron/main.ts:21–60  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

19let mainWindow: Electron.BrowserWindow | null
20
21function createWindow() {
22 const icon = nativeImage.createFromPath(`${app.getAppPath()}/build/icon.png`)
23
24 if (app.dock) {
25 app.dock.setIcon(icon)
26 }
27
28 mainWindow = new BrowserWindow({
29 ...getWindowBounds(),
30 icon,
31 minWidth: 1000,
32 minHeight: 600,
33 frame: false,
34 transparent: true,
35 webPreferences: {
36 nodeIntegration: true,
37 enableRemoteModule: true
38 }
39 })
40
41 if (process.env.NODE_ENV === 'development') {
42 mainWindow.loadURL('http://localhost:4000')
43 } else {
44 mainWindow.loadURL(
45 url.format({
46 pathname: path.join(__dirname, 'renderer/index.html'),
47 protocol: 'file:',
48 slashes: true
49 })
50 )
51 }
52
53 mainWindow.on('close', () => {
54 setWindowBounds(mainWindow?.getBounds())
55 })
56
57 mainWindow.on('closed', () => {
58 mainWindow = null
59 })
60}
61
62async function createMenu() {
63 await i18n.loadNamespaces('applicationMenu')

Callers 1

main.tsFile · 0.85

Calls 2

getWindowBoundsFunction · 0.90
setWindowBoundsFunction · 0.90

Tested by

no test coverage detected