Sitemap

Get the main window object of an Electron Application.

1 min readFeb 5, 2019

Introduction

Get the main window object of an Electron Application.

Finding the main window of an electron app could become tricky, this NPM package helps you with the same

Initially, I created the “electron-main-window” NPM package as an internal utility for OpenMTP — Advanced Android File Transfer Application for macOS. It works well with the Electron React Redux Advanced Boilerplate and electron-react-boilerplate.

Installation

$ npm install electron-main-windowor $ yarn add electron-main-window

Usage

// Import ES6 way
import { getMainWindow } from 'electron-main-window';
const mainWindow = getMainWindow();
// Import ES2015 way
const mainWindow = require('electron-main-window').getMainWindow();
// e.g:
if(mainWindow !== null ){
mainWindow.webContents.send('mainWindowCommunication', "This is a test message");
}

More repos

License

electron-main-window | Get the main window of an Electron Application is released under MIT License.

Copyright © 2018-Present Ganesh Rathinavel

--

--

Ganesh Rathinavel
Ganesh Rathinavel

Written by Ganesh Rathinavel

The J̶a̶v̶a̶S̶c̶r̶i̶p̶t̶ Dart Guy

No responses yet