All Questions
Tagged with electron javascript
485
questions
249
votes
11
answers
243k
views
Electron require() is not defined
I'm creating an Electron app for my own purpose. My problem is when I'm using node functions inside my HTML page it throws an error of:
'require()' is not defined.
Is there any way to use Node ...
31
votes
2
answers
88k
views
array.length is zero, but the array has elements in it [duplicate]
I'm currently in the process practicing using electron, but I'm quite new with javascript and I've come across a problem which has me completely baffled. I have the following code:
function ...
103
votes
6
answers
108k
views
How to use preload.js properly in Electron
I'm trying to use Node modules (in this example, fs) in my renderer processes, like this:
// main_window.js
const fs = require('fs')
function action() {
console.log(fs)
}
Note: The action ...
94
votes
4
answers
103k
views
How to access DOM elements in electron?
I am trying to add functionality to a button in index.html file is as follows:
I have a button element in index.html
<button id="auth-button">Authorize</button>
In main.js of the app, I ...
97
votes
24
answers
433k
views
How do I reload a page with react-router?
I can see in this file (https://github.com/ReactTraining/react-router/blob/v0.13.3/modules/createRouter.js) that there is a refresh function but I have no idea how to call it. I'm fairly new to react-...
68
votes
3
answers
131k
views
Saving files locally with electron
I have some template files that contain a few variable strings each, I'd like to build a very simple input form with Electron (https://www.electronjs.org/) and I want to save the composed output file ...
51
votes
3
answers
103k
views
Atom Electron - Close the window with javascript
I'm using Electron (formerly atom-shell) and would like to have a minimalist frame window so that the three OSX window buttons (close, maximize, minimize) are visible from within the HTML page.
I set ...
28
votes
5
answers
65k
views
How to close electron app via javascript?
I am running an express app via electron.
Below is the main.js
const electron = require("electron"),
app = electron.app,
BrowserWindow = electron.BrowserWindow;
let ...
2
votes
2
answers
2k
views
Electron - Setting up IPC communication between main and renderer processes
I am using https://github.com/maxogden/menubar to create a menubar desktop application with Electron. However, I am struggling to get basic IPC communication set up. Any idea why the below code doesn'...
62
votes
6
answers
87k
views
Uncaught Error: Cannot find module 'jquery'
I am using Electron to make a desktop app. In my app I am loading a an external site (outside Atom app) lets say http://mydummysite/index.html page.
Here is the structure of my app in Atom Editor:
i....
45
votes
1
answer
19k
views
Electron IPC and nodeIntegration
So, I've followed a number of guides to set up Webpack, Electron, and React to make a desktop application. After finishing the setup, I got to work, and learned that I needed to require an IPC ...
11
votes
1
answer
18k
views
How to view a PDF in an Electron BrowserWindow?
So I have this Electron app and in one of the .html-files I link another script that provides some utility-functions to the program and one of those is this one:
function openPDF(filePath){
let ...
11
votes
1
answer
8k
views
Insert text into an existing / external draftjs textfield
I'm working on an application which needs to insert text into a contenteditable="true" div (a Draftjs based textfield to be precise).
Now I am aware that Draft.js uses react and that it should be ...
9
votes
3
answers
6k
views
Unable to use Node.js APIs in renderer process
Unable to use any electron or node related operations in electron .
Getting error process not defined.
I Checked at various places they guide to add node Support but that is already Done so stucked ...
6
votes
1
answer
6k
views
Electron nodeIntegration not working, also general weird Electron behavior [duplicate]
I'm new to Electron, and I've really been struggling with getting it to work. I'm experiencing behavior I cannot explain, so here's a sum:
I cannot get the communication between Electron and the html ...