DocsAPImainregisterRoute

registerRoute

Registers a window as a route of the application.

The registerRoute method returned by the createElectronRouter function registers a window as a route of the application. This means that only the content defined from the corresponding route in the renderer process for that window will be displayed in it.

Basic Example

  registerRoute({
    id: 'main',
    browserWindow: mainWindow,
    htmlFile: path.join(__dirname, '../renderer/index.html'),
  })

API Reference

PropertyTypeDefault

id

stringmain

query?

object

port?

numberThe port defined in the createElectronRouter function or 3000

htmlFile

string

browserWindow

Electron.BrowserWindow