Skip to content

Latest commit

 

History

History
59 lines (44 loc) · 1.31 KB

File metadata and controls

59 lines (44 loc) · 1.31 KB




Creating Windows

At src/main/windows create a folder named as MyWindow and inside this folder an index.ts with the following content:

import { createWindow } from 'main/factories'

export function MyWindow() {
  const window = createWindow({
    id: 'myWindow',
    title: 'My Window',
    width: 450,
    height: 320,
    alwaysOnTop: true,
  })

  return window
}

Then, at src/main/windows/index.ts, add the MyWindow:

export * from './MyWindow'
export * from './About'
export * from './Main'

Now, at src/main/index.ts, you can use it like:

import { app } from 'electron'

import { makeAppSetup } from './factories'

import {
  registerAboutWindowCreationByIPC,
  MainWindow,
  MyWindow,
} from './windows'

app.whenReady().then(async () => {
  await makeAppSetup(MainWindow)
  registerAboutWindowCreationByIPC()
  MyWindow()
})

Creating a Window by IPC

Check the About window example and its usage.