electron

Distinction between the renderer and main processes in Electron

拥有回忆 提交于 2019-12-02 17:40:00
I originally thought that the renderer process in Electron was sandboxed in a chrome-like environment, meaning all you can do is mess with the DOM. However, I recently learned that you can access the filesystem, run child processes and get their output, and import any other node modules you want. If this is the case, what exactly is the distinction between the main process and the renderer process? Is it not a hard separation? What kind of code goes in the main process and what kind of code goes in the renderer process? If anyone has a good in-depth reading/presentation on Electron app

Run python script in Electron app

眉间皱痕 提交于 2019-12-02 17:21:54
I have a Electron project which executes some python script using NodeJS's child_process module. My python script is in the root folder of my project. Here's how I call the python script: let py = spawn('python',['ResolvePosition.py', obsFilePath, navFilePath]) py.stdout.on('data', data => console.log('data : ', data.toString())) py.on('close', ()=>{ // Python ends, do stuff }) This works fine if I run my electron app with npm start When I build an executable for Windows using the npm module electron-builder and run the executable from dist/win-unpacked/my-app.exe , this won't work, it seems

How to persist data in an Electron app?

可紊 提交于 2019-12-02 15:32:29
I've been scouring the Electron documentation to try and figure out how to persist data in an Electron app. For example, in iOS or OS X, you could use NSUserDefaults to store user settings and preferences. I would like to do something similar. How can I persist data in an Electron app? NeDB is the only suggested or featured tool as an embedded persistent database for Electron by Electron, currently. - http://electron.atom.io/community/ It's also could be useful to store user settings if settings are complex. Why NeDB could be a better solution on this case? Embedded persistent or in memory

Python on Electron framework

坚强是说给别人听的谎言 提交于 2019-12-02 14:56:55
I am trying to write a cross-platform desktop app using web technologies (HTML5, CSS, and JS). I took a look at some frameworks and decided to use the Electron framework. I've already done the app in Python, so I want to know if is possible to write cross-platform desktop applications using Python on the Electron framework? Thank you bluesummers It is possible to work with Electron but if you are looking for "webbish" UI capabilities, you can check Flexx - it allows you to code in pure Python but still use the styling and UI flexibility of web development tools. If you insist on going on

Electron.js How to minimize/close window to system tray and restore window back from tray?

送分小仙女□ 提交于 2019-12-02 14:14:58
I want my Electron.js application to live on system tray and whenever the user wants to do something they can restore from the system tray do something and minimize/close it back to system tray. How do i do that? I've seen the tray section from the documentation but doesn't help much to achieve what i want. Here is what i got so far on the main.js file var application = require('app'), BrowserWindow = require('browser-window'), Menu = require('menu'), Tray = require('tray'); application.on('ready', function () { var mainWindow = new BrowserWindow({ width: 650, height: 450, 'min-width': 500,

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

有些话、适合烂在心里 提交于 2019-12-02 13:11:41
问题 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

Electron callback can only be called for once

穿精又带淫゛_ 提交于 2019-12-02 11:29:25
问题 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

Uncaught Error: spawn .\node.exe ENOENT

强颜欢笑 提交于 2019-12-02 10:40:03
问题 I have a nodejs app being run through electron https://github.com/frankhale/electron-with-express After packaging the app as an executable using npm run dist:win32 , I ran into the following issue in console: events.js:160 Uncaught Error: spawn .\node.exe ENOENT Below is how my devDependencies looks like "devDependencies": { "electron-builder": "^5.26.0", "electron-prebuilt": "^1.3.3", "electron-rebuild": "^1.2.0" } When i run the app using npm start it works fine, and no error is run. Its

How to reduce Electron package size that exceeds more than 600 mb

点点圈 提交于 2019-12-02 09:50:33
I see this is because of node-modules and application is packaged with some unwanted stuffs for running. Current file size is 600 mb but I want it to be less than 200 mb. I suspect --no-prune populates all the node-modules in package that is built, but I need only specifies node-modules in the package that is built I tried removing unwanted packages in package.json, it doesn't help me either after refactoring "bundledDependencies": [ "fs", "os", "path", "regedit", "request", "start", "xml2js", "util", "replace", "process", "fs", "console" ], **before refactoring** "bundledDependencies": [

connecting to TFS using windows auth in electron app

不羁岁月 提交于 2019-12-02 09:08:11
i'm building an electron app that connect to a TFS server and retrieve some data from it. They use Windows credential to access TFS , how can i connect to TFS using Windows credential through chrome or node.js ? i tried this code but give me 401 : unauthorized $.ajax({ url: 'https://tfs.myserver.com:8090/tfs/IKM.TPC.Projects/MR/_workitems', type: 'GET', dataType: 'json', xhrFields: { withCredentials: true } }) .done(function (data) { $('#result').text(data); }) .fail(function (jqXHR, textStatus, errorThrown) { $('#result').text(textStatus); }); Simple steps: Create a login page to let user