electron

Electron callback can only be called for once

一个人想着一个人 提交于 2019-12-02 05:31:01
I have a simple electron app that wraps around a web app that prompts for username and password. Problems: 1) When the user inputs the wrong credentials and the authWindow appears again. With the right credentials the second time login does not happen. 2) When the user inputs the wrong credentials twice, the authWindow no longer appears. Any help is appreciated. Here is my code: const { app, BrowserWindow, ipcMain } = require('electron'); app.on("login", (event, webContents, request, authInfo, callback) => { event.preventDefault(); createAuthWindow().then(credentials => { callback(credentials

Module version mismatch. Expected 49, got 48

北战南征 提交于 2019-12-02 05:18:58
问题 I am using Electron module mdns and I am getting this error A JavaScript error occurred in the main process Uncaught Exception: Error: Module version mismatch. Expected 49, got 48. at Error (native) at process.module.(anonymous function) [as dlopen] (ELECTRON_ASAR.js:167:20) at Object.Module._extensions..node (module.js:568:18) at Object.module.(anonymous function) [as .node] (ELECTRON_ASAR.js:167:20) at Module.load (module.js:458:32) at tryModuleLoad (module.js:417:12) at Function.Module.

Print: How to stick footer on every page to the bottom?

爱⌒轻易说出口 提交于 2019-12-02 05:06:11
问题 I'm trying to print a generated HTML document to PDF. The document itself can hold multiple pages. Every page is built up like this: <!-- Header --> <!-- Content --> <!-- Footer --> All three look fine on every page. The only problem is that the footer won't stick at the bottom... The footer will always catch up with the last element of the page. As long as the page is filled with enough content the footer will be at the bottom as you would expect it to be. Here is my CSS: .docFooter{ display

opening pdf files in electron

ⅰ亾dé卋堺 提交于 2019-12-02 04:51:55
问题 I need to build an app where the user can open PDF files within the app -- i.e. not by opening a new browser window. I would need to implement a back button and possibly some overlays over the PDF. Does anyone know if there's a good way to do this in Electron? 回答1: If you're OK with UI provided by chrome PDF extension you can use it from electron. See this question const {app, BrowserWindow} = require('electron') app.once('ready', () => { let win = new BrowserWindow({ webPreferences: {

Electron - How to add react dev tool

大兔子大兔子 提交于 2019-12-02 04:31:57
What is the easy way to add react dev tool to electron window? I try add the extension hash BrowserWindow.addDevToolsExtension('path/to/extension/ade2343nd23k234bdb').15.01 But when the extension update, I had to manually update the string in main.js. I'm looking for a better way. Here is a Solution for Electron <= 1.2.1 version 1- In your app folder npm install --save-dev electron-react-devtools 2- Open your electron app, click on (view/toggle developer tools). In the console tab insert the following code and hit enter : require('electron-react-devtools').install() 3- Reload/refresh your

Uncompressed, unencrypted, unaltered, raw transfer of real-time PCM audio data through WebRTC stream

天涯浪子 提交于 2019-12-02 04:12:26
I'm transferring a live audio stream between 2 Electron window processes using WebRTC. There are no ICE or STUN servers, or anything like that, the connection is established manually through Electron IPC communication (based on this code ). Note: from the technical point of view regarding the audio streams themselves, this is very similar (if not identical) to streaming between 2 browser tabs on the same domain, so this is primarily not a question regarding Electron itself, although Electron IPC would be obviously substituted with a browser equivalent. The audio stream works, I can transmit

Can we launch a node command on a mac without node installed when using electron-packager?

拟墨画扇 提交于 2019-12-02 04:04:06
When I package an electron app using electron-packager. The app spawns a child process which uses a 'node' command. Now if I try to launch my app in a system with no node installed on it, does the app work? I have been trying to achieve this and facing various issues, the electron community suggested me to use fork method, spawn method with 'Process.execPath' as command and also setting the ELECTRON_RUN_AS_NODE variable but nothing seems to work on my end. Now after doing all this I question myself, do I definitely need node installed on my system to run the app? or is there really a way that

electron教程(番外篇二): 使用TypeScript版本的electron, VSCode调试TypeScript, TS版本的ESLint

三世轮回 提交于 2019-12-02 03:24:12
我的electron教程系列 electron教程(一): electron的安装和项目的创建 electron教程(番外篇一): 开发环境及插件, VSCode调试, ESLint + Google JavaScript Style Guide代码规范 electron教程(番外篇二): 使用TypeScript版本的electron, VSCode调试TypeScript, TS版本的ESLint electron教程(二): http服务器, ws服务器, 子进程管理 electron教程(三): 使用ffi-napi引入C++的dll electron教程(四): 使用electron-builder或electron-packager将项目打包为可执行桌面程序(.exe) 引言 这一篇将介绍: 1. 如何将electron替换为 TypeScript . 2. 如何使用VSCode调试 TypeScript . 3. 如何使用 ESLint 插件来检查 TypeScript 代码. 注: TS 是 TypeScript 的简称, 在本文中, 这两个名字的所指代的内容完全相同. TS版本electron 1. 部署node.js+electron环境 按步骤完成 electron教程(一): electron的安装和项目的创建 所介绍的内容. 2. 安装TypeScript

Electron - How to add react dev tool

北慕城南 提交于 2019-12-02 03:10:33
问题 What is the easy way to add react dev tool to electron window? I try add the extension hash BrowserWindow.addDevToolsExtension('path/to/extension/ade2343nd23k234bdb').15.01 But when the extension update, I had to manually update the string in main.js. I'm looking for a better way. 回答1: Here is a Solution for Electron <= 1.2.1 version 1- In your app folder npm install --save-dev electron-react-devtools 2- Open your electron app, click on (view/toggle developer tools). In the console tab insert

Electron global variable garbage collected if renderer process closes?

ⅰ亾dé卋堺 提交于 2019-12-02 03:02:58
问题 In Electron, I have my main process opening a BrowserWindow. The BrowserWindow loads one html page and then the same window eventually loads another html page. main.js var mainWindow; global.mainState = { settings: {} } mainWindow = createWindow('main', { width: 1000, height: 800, }); if (curState == 'load') { mainWindow.loadURL(`file://${__dirname}/interface/load.html`, {}) } if (curState == 'login') { mainWindow.loadURL(`file://${__dirname}/interface/login.html`, {}) } load.html const