electron

Electron: Cannot read property 'send' of undefined

こ雲淡風輕ζ 提交于 2019-12-25 04:07:06
问题 I'm trying to read the files from a directory using the fs module, and display that in a div with the id displayfiles in an Electron app. I keep getting the error : Cannot read property 'send' of undefined Here is my renderer.js // This file is required by the index.html file and will // be executed in the renderer process for that window. // All of the Node.js APIs are available in this process. const electron = require('electron'); const dialog = electron.dialog; const fs = require('fs');

How can a MenuItem be separated into its own module in Electron?

左心房为你撑大大i 提交于 2019-12-25 02:15:10
问题 New to Electron and building menus I'm trying to see if I can separate a MenuItem to prevent an enormous file but I'm having issues. For example I've separated the menu code outside of main.js and I moved menu in a renderer directory within a Menu directory. I can call the Menu from main.js with: let mainMenu = Menu.buildFromTemplate(require('./renderer/Menus/mainMenu')) mainMenu.js : module.exports = [ { label: 'Foo', id: 'itemFoo', submenu: [ {label: 'Enter Foo'}, {label: 'Exit Foo'} ] }, {

VUE Router not working with two Electron BrowserWindows

丶灬走出姿态 提交于 2019-12-25 01:34:52
问题 I’m trying to create an app with two BrowserWindows using the same Vue App with vue-router, but the router aren’t working. I’m always receiving error ‘Cannot GET /’ for the second route. main\index.js var mainURL = `http://localhost:9080/` var secondURL = `http://localhost:9080/page2` function createWindow () { mainWindow = new BrowserWindow({ height: 600, width: 800 }) mainWindow.loadURL(mainURL) mainWindow.on('closed', () => { mainWindow = null }) secondWindow = new BrowserWindow({ height:

Child process maximum limit

无人久伴 提交于 2019-12-25 01:10:02
问题 I want to compute the size of folder (i used readdirp module). For large folder the operation blocks my main thread so my electron application hangs. So i moved size computation process to forked child. since i have array of folders, i looping and forking new child process, on every iteration. These child Nodes are still whole new instances of V8. Assume at least 30ms startup and 10mb memory for each new Node. That is, you cannot create many thousands of them. I have studied somewhere. so how

How to detect HDMI device is connected with Node JS?

六月ゝ 毕业季﹏ 提交于 2019-12-25 00:41:55
问题 We required HDMI info in Nodejs and Electron. If any HDMI is connected with system then we have to do some specific task with the Electron application. 回答1: You can give a try with @senzil/cec-monitor package or simmilar to monitor the HDMI devices. 来源: https://stackoverflow.com/questions/54553635/how-to-detect-hdmi-device-is-connected-with-node-js

nsis uninstaller not deleting registry for electron app - nsh script

我怕爱的太早我们不能终老 提交于 2019-12-25 00:14:43
问题 I've set my electron app to auto-start on windows: app.setLoginItemSettings({ openAtLogin: true, path: process.execPaths }) This adds an entry to registry at location Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run\electron.app my app I'm using electron-builder to package my app. It's mention there that I can add a script installer.nsh at the time of nsis uninstallation. Here's my custom installer.nsh : !macro customUnInstall SetRegView 64 DeleteRegKey /ifempty SHCTX

Can't compile native module against electron instead of node.js

你离开我真会死。 提交于 2019-12-24 21:42:44
问题 I am writing a simple native module to use with electron app, but it compiles with the NODE_MODULE_VERSION 72 (node's version) instead of 73 (electron one). I used every possible step described here. electron-rebuild creates a folder structure bin/darwin-x64-73 (where 73 I suppose means module version), but upon requiring it from electron, app threw's with the same error Here's my simple binding.gyp: { "targets": [ { "target_name":"module_name", "sources":["path/to/module.cpp"], } ] } and I

Promise returns with 'undefined' or babel compiled code doesn't wait for return (async/await)

。_饼干妹妹 提交于 2019-12-24 19:24:09
问题 There is an async function ( send ) in which if the msg attribute is not defined, another function ( getNextProcess ) sets its value. getNextProcess performs a database query within a Promise. The query callback the Promise resolve function. Problem: After translating the code with Babel, msg will always be 'undefined'. Promise runs in the background independently and returns with the correct value (checked with console log). /* ORIGINAL */ class MyClass(){ /* construct & other codes here...

Navigate on same page via element id in electron

 ̄綄美尐妖づ 提交于 2019-12-24 18:50:29
问题 I want to navigate via href in <a> elements in electron. Which works like a charm in Firefox throws following exception in Electron/Chromium: Not allowed to navigate top frame to data URL The element (transformed via XSLT stylesheet from an XML, so I can't really change it) looks e.g. like this: <a href="#idPFMOB">Mobility</a> where the element with the id idPFMOB is an <h2> -Tag. As I said, this works in Firefox when I open the file there, but throws given exception in Chromium. Is there a

Asynchrony issue on Electron

时间秒杀一切 提交于 2019-12-24 18:13:12
问题 I'm currently working on an Electron.js app and I'm stuck on an asynchrony problem. I have three function (downdloadFile()) inside three if statements to be executed in sequence but they run asynchronously; I already tried using async/await but it didn't worked. Here's my code: ipcMain.on('play',(event,payload) => { launcherConfig.savedRam = payload.savedRam; launcherConfig.savedMaxPermSize = payload.savedMaxPermSize; if(payload.selectedPacket) { //FIRST IF if (!fs.existsSync(launcherDir + "\