electron

Electron - Not allowed to load local resource

拈花ヽ惹草 提交于 2019-12-03 11:33:20
问题 Evening, I'm looking into using electron to package an existing angular2 build. I thought I had a dry run working but the actual packaging seems to be failing (see final step below) and I want to understand why. Here's what I'm doing... Create Project Use angular-cli to start a new project ng new electron-ng2-cli --style=scss Install electron and electron-builder Edit package.json Make the following additions... "main": "main.js" "build": { "appId": "com.electrontest.testapp", "mac": {

Listen for keyboard events and mouse movement outside of Electron app

五迷三道 提交于 2019-12-03 11:30:45
I've been getting into a few Electron projects and I am trying to figure out how you could listen for any keypresses or and track mouse movement when the app is in the background. I am using the menubar plugin so the app is still running in the background. I tried using the global-shortcut API but it looks like that is for shortcuts only and you can't register individual keystrokes. I've also looked over the API and have yet to find an event for keystrokes and mouse movements outside the app's main screen. justin.m.chase This is outside of the realm of normal use-cases for an electron

How to use React Router with Electron?

孤人 提交于 2019-12-03 10:34:34
问题 Using this boilerplate as reference I created an Electron app. It uses webpack to bundle the scripts and express server to host it. Webpack config is practically same as this and server this. Electron's script loads: mainWindow.loadURL('file://' + __dirname + '/app/index.html'); And index.html loads the script hosted by the server: <script src="http://localhost:3000/dist/bundle.js"></script> I run electron index.js to build the app and node server to start server which using webpack bundles

Find OS username in NodeJS

女生的网名这么多〃 提交于 2019-12-03 10:31:49
How would I find the username that the computer owner is using currently (while logged in), using NodeJS? I have searched around a bit, but haven't found anything... drowZ I am not sure why, but someone added an answer and then deleted it quickly after... I was fast enough to catch it though, and after checking, it is the shortest and most effective way of doing what I asked before: require("os").userInfo().username The only problem is, in Windows 10, it returns the first name of the owner account that has been used (just a heads up). Everything else works completely fine! ankur kumar This one

How to enable file upload on React's Material UI simple input?

微笑、不失礼 提交于 2019-12-03 10:30:41
问题 I am creating a simple form to upload file using electron-react-boilerplate with redux form & material ui. The problem is that I do not know how to create input file field because material ui does not support upload file input. Any ideas on how to achieve this? 回答1: Another >=v1.0 solution that makes more sense to me structurally than @galki's solution. RaisedButton is deprecated in >=v1.0. I cannot find more information on containerElement (it may have been undocumented?) but the current API

Showing window after it is fully loaded

夙愿已清 提交于 2019-12-03 10:27:23
When I create basic application and initialize it using electron command, it shows me a blank window and a moment later loads the content. Which event and which object should be used to show the window after the content is fully loaded? did-finish-load on a window.webContent object? Or maybe dom-ready ? Or maybe something else? app.js : var app = require('app'), Window = require('browser-window'), mainWindow = null; require('crash-reporter').start(); app.on('ready', function() { mainWindow = new Window({ width: 600, height: 400, show: false }); mainWindow.loadUrl('file://' + __dirname + '

Electron & ReactJS, Use BrowserWindow for GitHub oAuth authentication

心不动则不痛 提交于 2019-12-03 10:17:18
问题 I have set up github's Electron with ReactJs. So I got a BrowserWindow and a react app playing nicely in that window. What I'm trying to achieve is to get authenticated with GitHub. So when a user presses the Login with Github button, a new BrowserWindow opens and goes to the github authorize app url. The issue I have has to do with the callback and how I will get the code returned from the callback. I've done it with Apache Cordova and the InAppBrowser but it was different since I was able

how to use electron browser window inside components in angular-cli?

匿名 (未验证) 提交于 2019-12-03 09:05:37
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Angular-cli doesn't accept the electron inside components. how to use electron browser window inside components in angular-cli? I got an error fs.existsync like this. Is there any other options to use electron with angular2 components? var electron = require('electron'); or import electron from 'electron'; Both are not working inside ts? 回答1: You can only do this by initialize electron variables inside index.html and you can communicate wherever you want inside typescript. Use electron variables inside TS. 回答2: This will help you to

iframe with local resource in Electron

匿名 (未验证) 提交于 2019-12-03 09:02:45
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: 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 allowed to load local resource :

How to require(&#039;electron&#039;) when script is loaded by system.js

匿名 (未验证) 提交于 2019-12-03 09:02:45
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: 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: system.js:4 GET file:///D:/Code/aurelia-electron