electron

electron-builder package for windows in dev mode

半城伤御伤魂 提交于 2019-12-11 19:07:03
问题 I need to test my app on windows, but I am using a mac. It is very easy to package the app to run on windows, but I cannot package the app in dev-mode. I am using electron-is-dev to decide if I am running in dev or not. I need to run my tests on windows because I am testing a very specific windows hardware functionality. I don't want to comment my if(isDev){doSomething} just to run these test, and then uncomment it before I push the change. I was hoping there is some flag I can set in the

What's the correct way to run a function asynchronously in Electron?

早过忘川 提交于 2019-12-11 18:56:34
问题 I want to run a simple function asynchronously in Electron, so it doesn't block my render thread. So, something (very roughly) like this (within render.js ): var max = 42; // Somehow needs to be passed to the function function foo() { for (var i = 0; i < max; i++) { // Do something... // ... and tell the render thread about it. } } foo(); // Should run asynchronously There are two requirements: I must pass parameters to the function (here: max ). These could not only be integers, but also

mainWindow.on('close') gets called more than one time when I hide mainWindow

十年热恋 提交于 2019-12-11 18:54:30
问题 I made a basic electron tray that opens a window when one of it's options is clicked. I check if I opened a BrowserWindow with a bool and create or show/hide the window. const contextMenu = Menu.buildFromTemplate([ { label: 'Open configuration menu', click:() => { console.log("called createwin"); createwin(); } And createwin is: function createwin(){ if (windowshown == false) { mainWindow = new BrowserWindow({ width: 1000, height: 800, webPreferences: { nodeIntegration: true } }) console.log(

Transform XML String [not file!] with XSLT String in Node.js to HTML

邮差的信 提交于 2019-12-11 18:45:38
问题 I have two strings. The first one is a xml string, saved as a string, not from a file. The second one is a string I load from a XSLT file with fs.readFile(...) . I already tried using libxslt but can't install it via npm due to some errors about MSBuildTools and so on. Are there any alternatives for libxslt ? I already came across xslt-processor too, but it only accepts files as parameters. EDIT 1: to provide you an overview, the XSLT file and an example XML file (both handled as strings in

Electron - Why set BrowserWindow instance to null on the close event

心已入冬 提交于 2019-12-11 18:22:11
问题 The electron documentation, provides the following code sample to create a new window: const {BrowserWindow} = require('electron'); let win = new BrowserWindow({width: 800, height: 600}); win.on('closed', () => { win = null }); win.loadURL('https://github.com'); My question is: why set win to null at the close event? N.B. The BrowserWindow class inherits from class EventEmitter. I am not sure if this information is relevant, but I thought it might help to include it in the question. Please

How to store application settings for all users

别来无恙 提交于 2019-12-11 18:16:21
问题 I want save some configuration for my electron app. I'm using electron-json-storage to store data. but it store data in app data of current user. I have tried to store data in installation directory using storage.setDataPath(directory) but it requires administrative privillages I building with nsis mode per-Machine: true Is there any common storage in electron or any other options to overcome this situtation 来源: https://stackoverflow.com/questions/57765705/how-to-store-application-settings

Electron change frame on/off from remote

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 17:12:51
问题 Can someone tell me if it's possible to toggle frame property of BrowserWindow object using remote ? I have tried to add this property to remote.getCurrentWindow().setBounds but that doesn't work. thanks 回答1: You cannot do that. Here's the rejected feature request for this: github.com/electron/electron/issues/1145 Quote from zcbenz Enabling removing window frame on the fly will add too much complexity to the code, and it is not easy to implement. I don't think it deserves the efforts, even

Drag'n'Drop into Electron app is not allowed

我们两清 提交于 2019-12-11 17:06:03
问题 I am trying to implement Drag'n'Drop functionality for users to easier upload their images. In browser the drop area works perfectly but Electron is preventing files to be even dropped into the app. Every time I try to drop a file cursor changes to the one shown below and nothing happens. I thought maybe Electron had configs to disable dropping files by default due to popular complain but I couldn't find any solution. The picture shows the drop area, but the same issue is all across the app.

Electronjs window.require not a function

旧巷老猫 提交于 2019-12-11 16:56:43
问题 I'm using create-react-app (react-scripts v3.0.0) and electronjs (v5.0.1). I'm trying to pass events from the renderer to main process using the 'icpMain' module as described here, but get the error window.require is not a function for the line const { ipcRenderer } = window.require('electron'); How can I get require into the global scope in the renderer process? Or is there another way of communicating between the main and renderer process? Edit: I've tried removing the react build entirely

How to set npm start for electron app with “babel-node --presets es2015,stage-3”

落爺英雄遲暮 提交于 2019-12-11 16:42:36
问题 I'm trying to get my npm start working for electron. I know that you usually start a not distributed/packed app with electron . or ./node_modules/.bin/electron . . Since I was playing around with NodeJS v8.4.0 together with ES6/7 syntax I did end up with this npm start script in my package.json: "scripts": { "start": "babel-node main.js --presets es2015,stage-3" } Everything worked well I was able to use import for example without any issues. Now I want to use electron together on the fly