How to use electron-reload - 4 common examples

To help you get started, we’ve selected a few electron-reload examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github brtjkzl / coypu / src / desktop / main.ts View on Github external
import { app, BrowserWindow } from "electron";
import electronReload from "electron-reload";
import electronWindowState from "electron-window-state";

electronReload(__dirname);

// To avoid garbage collector; don't remove!
let mainWindow;

const createWindow = () => {
  let windowState = electronWindowState({
    defaultWidth: 420,
    defaultHeight: 640
  });

  mainWindow = new BrowserWindow({
    x: windowState.x,
    y: windowState.y,
    width: windowState.width,
    height: windowState.height,
    minWidth: 370,
github ubergrape / grape-electron / src / index.js View on Github external
const init = () => {
  if (isDevelopment) {
    electronReload(__dirname, {
      electron: path.join(__dirname, '../node_modules/.bin/electron'),
    })
  }

  app.on('ready', () => {
    if (getOsType === 'windows') {
      // https://electronjs.org/docs/tutorial/notifications#windows
      if (isDevelopment) app.setAppUserModelId(process.execPath)
      else app.setAppUserModelId(pkg.appId)
    }

    const url = getUrlToLoad(store)
    const { searchParams, protocol } = new URL(url)
    const page = searchParams.get('page')

    if (page === 'connectionError' && protocol === 'file:') {
github RocketChat / Rocket.Chat.Electron / src / main.js View on Github external
import setupElectronReload from 'electron-reload';

import { setupErrorHandling } from './errorHandling';
import appData from './main/appData';
import './main/basicAuth';
import { processDeepLink } from './main/deepLinks';
import { getMainWindow } from './main/mainWindow';
import i18n from './i18n';

export { default as dock } from './main/dock';
export { default as menus } from './main/menus';
export { default as tray } from './main/tray';
export { default as certificate } from './main/certificateStore';

if (process.env.NODE_ENV) {
	setupElectronReload(__dirname, {
		electron: process.execPath,
	});
}

async function prepareApp() {
	setupErrorHandling('main');

	app.setAsDefaultProtocolClient('rocketchat');
	app.setAppUserModelId('chat.rocket');

	await appData.initialize();

	const canStart = process.mas || app.requestSingleInstanceLock();

	if (!canStart) {
		app.quit();
github satoshipay / solar / electron / src / index.dev.ts View on Github external
import autoReload from "electron-reload"
import path from "path"

const webappDistDir = path.join(__dirname)

autoReload(webappDistDir, {
  electron: path.join(__dirname, "..", "..", "node_modules", ".bin", "electron")
})

electron-reload

Simplest way to reload an electron app on file changes!

MIT
Latest version published 3 years ago

Package Health Score

48 / 100
Full package analysis

Popular electron-reload functions