Remote function - use Electron functions in JavaScript

Other topics

Using remote by setting the progress bar

const { remote } = require("electron"); // <- The Node.js require() function is
                                      // added to JavaScript by electron

function setProgress(p) { // p = number from 0 to 1
  const currentWindow = remote.getCurrentWindow();
  currentWindow.setProgressBar(p);
}

Using remote by setting window to fullscreen

const { remote } = require("electron"); // <- The Node.js require() function is
                                      // added to JavaScript by electron

function fullscreen(f) { // p = false or true
  const currentWindow = remote.getCurrentWindow();
  currentWindow.maximize();
}

Syntax:

  • use remote like require("electron"):
    • main.js:    const electron = require("electron");

      index.html: const electron = require("electron").remote;

Contributors

Topic Id: 8719

Example Ids: 27206,27207

This site is not affiliated with any of the contributors.