electron

fs module fails when integrating Electron into Angular project

扶醉桌前 提交于 2019-12-04 07:40:10
I have some trouble integrating Electron. When I use it as described in this blog post , everything works. Problems start when I want to use import Electron (electron.remote) to use it in Angular2 service to let the app using the desktop features like system dialogs and file system access. I get the following error when loading the app, in electron/index.js which is included in webpack bundle: Uncaught TypeError: fs.existsSync is not a function (index.js:6) The file looks quite simple: var fs = require('fs') var path = require('path') var pathFile = path.join(__dirname, 'path.txt') if (fs

Firebase database looses websocket connection which results in delays

纵饮孤独 提交于 2019-12-04 07:35:45
We are using Firebase Realtime Database in our Electron application. Executing "set" or "update" the first time after authentication works flawlessly. However, after waiting some time (idle > one minute), executing a update or set operation is delayed by 30 seconds up to 2 minutes. We are executing the following snipped in a promise: this.$fbDb.ref().update(updatedNodes).then(() => { console.log('Successfully created configuration.') resolve() }).catch((err) => { reject(err) }) The firebase log shows that the "Websocket connection was disconnected". Please see the following log and pay

How to bundle a third party binary with Electron?

核能气质少年 提交于 2019-12-04 06:07:40
I am still new to the electron ecosystem and desktop development in general but what I wish to do is to interface with a third party, open source application that comes bundled in with my software. First, I am unsure on what the package options to distribute should be. Is it customary to have two downloads, one for users that already have the third party binary installed, and another one that includes it? Also how do I go about actually packaging, and installing the binary? Should this be an option on my package.json? What kind of script should I execute? Are there any npm modules to

Electron(一)起步

此生再无相见时 提交于 2019-12-04 05:56:46
现在,您需要安装 electron 。 我们推荐的安装方法是把它作为您 app 中的开发依赖项,这使您可以在不同的 app 中使用不同的 Electron 版本。 在您的app所在文件夹中运行下面的命令: npm install --save-dev electron npm install --save-dev electron-packager package.json { "name": "your-app", "version": "0.1.0", "main": "main.js", "scripts": { "start": "electron .", "packager": "electron-packager . myApp --win --out ../myApp --arch=x64 --app-version=0.0.1 --electron-version=2.0.0" }, "dependencies": { "electron": "^7.1.1", "electron-packager": "^14.1.0" } } main.js const {app, BrowserWindow} = require('electron') // 保持对window对象的全局引用,如果不这么做的话,当JavaScript对象被 // 垃圾回收的时候

What is minimum system requirements to run electron apps?

丶灬走出姿态 提交于 2019-12-04 05:45:47
I am deciding between options for building native desktop app. I do not find any documentation for minimum system specs (OS/HW) for runtime of electron apps. Can you help me out? martpie based on Electron supported platforms and Chrome minimum requirements OS requirements Windows Windows 7 and later are supported, older operating systems are not supported (and do not work). Both x86 and amd64 (x64) binaries are provided for Windows. Please note, the ARM version of Windows is not supported for now. Mac Only 64bit binaries are provided for macOS, and the minimum macOS version supported is macOS

Electron: Call renderer function from main

六眼飞鱼酱① 提交于 2019-12-04 05:06:43
I have some data in the localstorage that has to be deleted on app.quit() . But I see no way to do so from the main process. Is there a way to call a renderer function from main ? I know about var remote = require('remote'); but it seems to go only in the wrong direction. You can send messages from the main process to a renderer process via webContents.send as called out in the documentation here: https://github.com/atom/electron/blob/master/docs/api/web-contents.md#webcontentssendchannel-arg1-arg2- . Here is how you do it straight from the docs: In the main process: // In the main process.

Avoid app throttling when Electron is in background

北城余情 提交于 2019-12-04 04:50:50
Consider the following example: setInterval(function() { console.log(new Date()); }); If I run it with electron example.js under OS X, it opens up an icon in my dockbar and starts printing out the time on the console. If the app is not focused, however, after a while it starts throttling. I looked around and found that this is due to OS X power saving strategy. Now, what if I needed it to keep working in background? My app will be a daemon doing a little bit of something every now and then, and I can't have my users blankly staring at my app for ages. I found out here that I can do electron

Electron JS Images from Local File System

送分小仙女□ 提交于 2019-12-04 04:26:39
I am new to electron and trying to load images from the local file system to display it on screen. So for images from the remote URLs are working just fine when I do <img src='https://example.com/image.jpg' /> But when I try to load the same image from the local file system in my render process it does not work <img src='file:///C:/tmp/image.jpg' /> is not rendered. This is the error I got: > Not allowed to load local resource: > file:///C:/tmp/nW4jY0CHsepy08J9CkF1u3CJVfi4Yvzl_screenshot.png > dashboard:1 Not allowed to load local resource: > file:///C:/tmp/TOyUYWnJK7VS9wWeyABhdgCNmp38FyHt

How to enable a pop up for authentication for electron?

旧时模样 提交于 2019-12-04 04:21:22
问题 I am creating an electron app that accesses a url. And when navigated to the URL the user clicks on a button and are redirected to a URL that displays this pop up in Chrome. How can I enable/show this popup in electron? It doesn't seem to enable it by default. 回答1: What you see on the picture is that Chrome opens a popup for handle authentication event. However, Electron doesn't make such popup by default, as it stated in the documentation of 'login' event The default behavior is to cancel

White Screen on Fresh New Angular 8/Electron 5 App

吃可爱长大的小学妹 提交于 2019-12-04 03:59:53
I am building and running an Angular 8/Electron 5 desktop app. After what I believe to be proper setup, running the app displays a blank white screen. Using: Electron 5.0.2 Angular CLI 8.0.1 Node 10.16.0 macOS Mojave 10.14.5 ... ng new my-app npm i -D electron package.json { ... "main": "main.js", //<-- ADDED "scripts": { "ng": "ng", "start": "ng serve", "build": "ng build", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e", "electron": "ng build --baseHref=./ && electron ." //<-- ADDED } ... } main.js const { app, BrowserWindow } = require("electron"); const path = require("path"); const