electron

Communicate between parent and child renderer process Electron JS

≡放荡痞女 提交于 2019-12-07 23:05:26
问题 Suppose we have the following 2 BrowserWindow instances created in main process: let fooA = new BrowserWindow({width:800,height:800}); fooA.loadUrl(url.format({ pathname: path.join(__dirname, './a.html'), protocol: 'file:', slashes: true })); let fooB = new BrowserWindow({parent:fooA}); fooB.loadUrl(url.format({ pathname: path.join(__dirname, './b.html'), protocol: 'file:', slashes: true })); As you can see fooB is child of fooA Now each browsers window html file is associated with a renderer

How to require('electron') when script is loaded by system.js

拈花ヽ惹草 提交于 2019-12-07 22:25:12
问题 I'm trying to use Aurelia and SystemJs within an electron app; I have a fairly basic app-window.js : const remote = require('electron').remote; document.getElementById("close-btn").addEventListener("click", function (e) { var window = remote.getCurrentWindow(); window.close(); }); ... if I consume it as normal html script ( <script src="app-window.js"></script> ) it works perfectly fine. However, if I have systemJS import it: <script> System.import('app-window.js'); </script> I get the error:

Embed Mongodb with Electron

≯℡__Kan透↙ 提交于 2019-12-07 17:10:44
问题 I am keeping MongoDB source code inside electron source code and running MongoDB using this command : const app = require('electron').app; const child_process = require('child_process'); const dbInstanceDir = app.getAppPath(); const startMongo = dbInstanceDir + mongodb/bin/mongod --dbpath mydbpath --port 27017 --logpath mylogfile child_process.exec(startMongo, (error, stdout, stderr) => { }); Above command is working while development but it not working after bundling. I am using electron

Extracting file icon and display in html

拥有回忆 提交于 2019-12-07 16:50:00
问题 Evening Everyone, I have started doing some research for an application i want to write using the electron framework. I have figured out how to display what i want to the user with the exception of the icons. There is a part of the application where the user can type a path and it will list the files in that path, i would like to pull the icon from the files so its displayed just like it would be in the windows file explorer. This is where i have been running into a roadblock and I'm looking

TestCafe with Electron: Determine if app is visible on Windows desktop

流过昼夜 提交于 2019-12-07 13:27:31
问题 Our Electron application starts minimized to the Windows tray notification area i.e. not visible on the desktop. If I attempt to get visibility information through methods such as this or as described here, checking the 'visible' property always returns true . For example, the below always returns true whether the app is minimized to the notification area or visible on the desktop: if(await Selector('button', { visibilityCheck: true }).visible) console.log("VISIBLE"); else console.log("NOT

Signing a Windows installer (.exe) for application created using Electron

回眸只為那壹抹淺笑 提交于 2019-12-07 13:04:58
问题 I have a simple app built using Electron framework . I packaged the code using electron-packager-interactive . I also created a Windows installer file which is ready for distribution using Inno Setup compiler (Single .exe file). The problem here is when users run the .exe file, a popup from Windows Smart screen blocks it saying publisher is unknown . Only after "More info", it allows to install with " Run anyway ". Probably it's because my application is not signed . So can anyone help me how

Having two isolated (in terms of history/cookies/localstorage) BrowserViews in the same BrowserWindow with Electron

与世无争的帅哥 提交于 2019-12-07 11:19:38
问题 Let's say I have two BrowserView in the same BrowserWindow and an UI button allowing the user to switch between showing bv1 or bv2 (like the "tab" system in browsers like Firefox, Chrome, that allows you to switch between the different pages): browserWindow = new BrowserWindow({ width: 1200, height: 600 }); let bv1 = new BrowserView({ webPreferences: { nodeIntegration: false }}); bv1.setBounds({ x: 0, y: 0, width: 1200, height: 600 }); bv1.webContents.loadURL('https://www.twitter.com'); let

How can I use node “fs” in electron within angular 5

岁酱吖の 提交于 2019-12-07 10:45:29
问题 I try to use Electron and Angular5 to write my first desktop App but unfortunately i am stuck in using the fs module. It seems that I have imported fs correctly (no errors within Visual Studio Code and code completion) but when i tried using "fs.readFile" the console prints out this error: Uncaught TypeError: __WEBPACK_IMPORTED_MODULE_2_fs__.readFile is not a function This is the code of my service so far: import { Injectable } from '@angular/core'; import { ElectronService } from 'ngx

iframe with local resource in Electron

ε祈祈猫儿з 提交于 2019-12-07 10:33:07
问题 I need to render iframe in my Electron application: <!DOCTYPE html> <html> <head> <title></title> </head> <body> <iframe sandbox='allow-scripts' src='frm.html'></iframe> </body> </html> where the frm.html links the local file script foo.js which is part of my Electron application <!DOCTYPE HTML> <html> <head> <title></title> <script src="foo.js"></script> </head> <body> <p>Inside iframe</p> </body> </html> When I run the application in Electron I can see this error in devtools console Not

Is there any way of using JSX in a native CommonJS environment?

孤者浪人 提交于 2019-12-07 10:01:31
问题 I'm starting a new project on an environment that has native CommonJS support for require modules - it's an atom-shell project, there is no possibility of using pre-compiling steps such as in Browserify or webpack AFAIK . I'm able to use JSX on my app.jsx entry-point file that is declared on my index.html , that's because JSXTransformer was declared previously: <script src="scripts/vendor/JSXTransformer.js"></script> <script type="text/jsx" src="scripts/app.jsx"></script> I want to be able to