electron

How do I set a chromium command line flag in Electron?

馋奶兔 提交于 2020-01-03 04:44:09
问题 I am working on an Electron app and need to enable the following Chromium flag GuestViewCrossProcessFrames to make scaling work with webview. I tried calling the following line in my main.js but it doesn't seem to work. Also tried enabling plugins for the BrowserWindow as well as webview. app.commandLine.appendSwitch('--enable-features=GuestViewCrossProcessFrames'); Can someone help me setting up this flag? Thank you. 回答1: you can set by calling const { app } = require('electron'); app

communication between 2 browser windows in electron

北战南征 提交于 2020-01-02 21:08:20
问题 I need to build an app that will span across multiple monitor screens, something like this: Electron suports multiple windows but how to comunicate between them? 回答1: The main thing to remember is that in Electron, interProcess communication is done by ipcMain (in the main process) and ipcRenderer(in all the created windows). Like below: From what i've seen in the GitHub comments - direct communication between the Renderer instances is not allowed. Everything must pass trough the mainProcess.

How do I implement a nfc reader (ACR122) to an Electron project?

感情迁移 提交于 2020-01-02 10:36:06
问题 I have downloaded this library (https://github.com/pokusew/nfc-pcsc) and now i'm trying to run an Electron project in it, but is giving me everytime problems when i try to run it as an Electron project. So my question is: How can I implement this library on my Electron project and make it work not as node.js I tried to npm install --save electron@latest in the library and change on the json the script "example": "node -r @babel/register examples/read-write.js" to "example": "electron -r

Close Electron frameless window not working

邮差的信 提交于 2020-01-02 04:54:07
问题 I'm building an app using electron 1.0 and unfortunately everywhere I look for guides and tutorials with it, no one uses electron 1 because it's so new. I am trying to close a frameless window through the click of a button I made. I know the button works because I have check to make sure it can do simple things (i.e. change some text or whatever) but that's only when I use internal javascript but I am trying to use external javascript. When I use external the function never gets called...

How to display a JPG image from a Node.js buffer (UInt8Array)

心不动则不痛 提交于 2020-01-02 03:11:10
问题 I have a custom Node.JS addon that transfers a jpg capture to my application which is working great - if I write the buffer contents to disk, it's a proper jpg image, as expected. var wstream = fs.createWriteStream(filename); wstream.write(getImageResult.imagebuffer); wstream.end(); I'm struggling to display that image as an img.src rather than saving it to disk, something like var image = document.createElement('img'); var b64encoded = btoa(String.fromCharCode.apply(null, getImageResult

Minimal Example: Opening a window in electron from react application?

醉酒当歌 提交于 2020-01-01 18:58:06
问题 Say I am building a desktop application with react/redux & electron. So my index.html file in electron looks like this: <!DOCTYPE html> <html> ... <body> <div id="content"></div> <script src="public/js/bundle.js"></script> </body> </html> My biggest React container (call it app.js) is loaded into the 'id=content' div. This works fine so far, but now I am wondering how to open a new file dialog window (or any new window for that matter) when the user clicks a button in my react application. I

Integrate jQuery into a electron app

China☆狼群 提交于 2020-01-01 03:17:06
问题 I'm trying to add jquery functionality to a desktop app written in electron Using the electron-quick-start repo i'm adding the downloaded jquery file to the main.html file like so: <script> require("./jquery.min.js"); </script> or so: <script>window.$ = window.jQuery = require('./jquery.min.js');</script> Then in the index.js file i'm adding code in the createWindow function, since that seems the proper place, but to be honest any place i try gets me the same error more or less. mainWindow.$

Electron kill child_process.exec

ぃ、小莉子 提交于 2020-01-01 02:16:45
问题 I have an electron app that uses child_process.exec to run long running tasks. I am struggling to manage when the user exits the app during those tasks. If they exit my app or hit close the child processes continue to run until they finish however the electron app window has already closed and exited. Is there a way to notify the user that there are process still running and when they have finished then close the app window? All I have in my main.js is the standard code: // Quit when all

将H5打包成exe桌面应用

﹥>﹥吖頭↗ 提交于 2020-01-01 02:08:48
这是一篇不断踩坑的博~~~~~~。 首先介绍我所知道的三种方式: 一.node-webkit(目前没踩它) 核心:用nodejs来进行本地化调用,用webkit来解析和执行HTML+JS 二.Electron、Electron-packager(首踩,还没跳出来) 安装前注意!!!不能用npm,要使用淘宝镜像cnpm,直接使用npm会在install.js就不往下执行了,原因是下载过程中注册源被墙的。cnpm,可以完全替代npm,并能访问国内的镜像。 安装cnpm npm install cnpm -g --registry=https://registry.npm.taobao.org 2.安装Electron cnpm install electron -D -D:将模块下载到目标项目中(推荐) -g:将模块下载到全局,文件位置在C盘 3安装Electron-packager 目前掉这个坑里还在爬~~~ 三.第三方打包工具 如果只是为了好玩,推荐使用。主要是不需要你有任何的知识储备,直接将能运行的H5文件导入,可视化的根据需求选择配置,两分钟就能生成你想要的exe。不过。。。。不过有使用时间限制,大概两天后exe就失效了,除非付费!!嗯,如果你想制作个性化exe icon等,也需要付费~~~~~ 参考文章: https://blog.csdn.net/zhujuyu

Send sync message from IpcMain to IpcRenderer - Electron

跟風遠走 提交于 2019-12-31 21:34:10
问题 In electron, It is possible to send sync message from IpcRenderer to IpcMain via ipcRenderer.sendSync('synchronous-message', 'ping') . Also possible to send async message from IpcMain to IpcRenderer using window.webContents.send('ping', 'whoooooooh!') but is there any way to send sync message from IpcMain to IpcRenderer? 回答1: There is no such functionality of ipcMain * . However, you can achieve almost the same result asynchronously with the following steps: Place your code which you would