electron

How do I handle local file uploads in electron?

痴心易碎 提交于 2019-12-05 12:38:31
问题 I'm having a hard time figuring out how to approach file uploads in atom electron. I would post code but I don't even know where to begin with this one. In a standard web app I would post from the client to the server, either via a standard postback or using an ajax request. I have some pretty cool solutions for that. But in the case of electron, I'm not sure where or how to "post" the file back. I guess I just want to access the contents of my <input type='file' /> from node.js. How do I do

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

别等时光非礼了梦想. 提交于 2019-12-05 12:28:45
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 use the JSX syntax for the sub modules that are imported as CommonJS modules inside my app.jsx module:

Importing node modules with electron and Systemjs

两盒软妹~` 提交于 2019-12-05 11:44:59
I just wondered if it is possible to make systemjs use require("remote").require("nodemodule"), if system js can't find the module in its own registry? I think something like this mechanism is already working when using electron with typescript and commonjs modules... Has someone already solved that struggle? Finally after some time I found a working solution: var node_modules = ["child_process","fs"]; var fetch = System.fetch; window.remote=require("remote"); System.fetch = function () { var promise= fetch.apply(System,arguments); return promise.then(function (js) { for(var m of node_modules)

Disable backspace in Atom-shell

痞子三分冷 提交于 2019-12-05 11:34:38
I've been scouring the interwebz and Atom-shell documentation trying to find out how to disable the back() functionality of the backspace key within a browser window. I would prefer not to have to resort to a javascript onkeydown listener (which works) and rather use something more native and at more of the application level instead of the browser window level. The only way I have figured out to do this without the onkeydown listener is with a global-shortcut and the ipc events in the Electron api. First a disclaimer... Disabling any key with a global shortcut really does disable it GLOBALLY

Electron - Can my app communicate with the main and renderer processes?

吃可爱长大的小学妹 提交于 2019-12-05 11:14:47
I have written a very, very basic electron application - The standard hello world type, where you basically have a HTML file which says "Hello, World" - and that lives in the "app" directory within electron, and then is loaded via main.js when you run the app. Now, lets say I want to be able to maybe communicate with either of those processes (main, or renderer, preferably both!) from the javascript within my application, can that be done? I can't really find anything online about it - but my main problem might be that I don't really even know what to be searching for in the first place. I am

Close Electron frameless window not working

拜拜、爱过 提交于 2019-12-05 10:33:57
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... const {remote} = require('electron'); const {BrowserWindow} = require('electron').remote; document

electron error AVDCreateGPUAccelerator: Error loading GPU renderer

隐身守侯 提交于 2019-12-05 09:45:14
I'm attempting my first electron App. Does anyone know why i get this error AVDCreateGPUAccelerator: Error loading GPU renderer in the terminal when i do npm start ? It doesn't seem to effect anything yet. I've gotten it right from the beginning of my install using the quick start guide. Will it effect me down the road? mac pro late 2013 2.7 GHz 12-Core Intel Xeon E5 128 GB 800 MHz DDR3 ECC AMD FirePro D700 6144 MB bounikos Most likely the AVDCreateGPUAccelerator error is because the Xeon CPUs used in the Mac Pros do not have a hardware decoder. Core i3/5/7 CPUs in Mac mini/iMac/Mac Book Pro)

Atom Electron capture all keyboard events even when app is unfocused

旧城冷巷雨未停 提交于 2019-12-05 09:31:28
I would like to know if there is a way to make an application with Atom Electron that runs and gets my keyboard events when the user is/isn't focused on my app. For example if he is on Chrome and writes something, my app will store all the keys that he pressed. I searched a little but didn't find something that solves my problem. The closest thing there is to what you're looking for is global shortcuts: https://github.com/electron/electron/blob/master/docs/api/global-shortcut.md . While you don't have anything in core Electron to support capturing all keyboard events out of the box, luckily

Write file to disk from blob in electron application

不羁的心 提交于 2019-12-05 08:27:25
I am creating an Electron Application in which I am recording data from webcam and desktop, at the end of the recording session, I want to save the data to a file in the background. I do not know how to write the data from a blob to a file directly. Any suggestions? Below is my current handling for MediaRecord Stop event. this.mediaRecorder.onstop = (e) => { var blob = new Blob(this.chunks, { 'type' : 'video/mp4; codecs=H.264' }); var fs = require('fs'); var fr = new FileReader(); var data = null; fr.onload = () => { data = fr.result; fs.writeFile("test.mp4", data, err => { if(err) { return

ES6 is not supported after Electron packaging

戏子无情 提交于 2019-12-05 07:43:47
I'm using various ES6 syntax (such as import etc.) & React code ( JSX ) in my Electron -based application. During the development, I'm using the electron-prebuilt-compile package (as a dev-dependency ) in order to support these new features and it works perfectly fine without any errors. But after packaging my app using the electron-packager package and running the distributable application file, I experiencing unsupported ES6-related errors such as: Unexpected token import That's is how I run the electron-packager command (notice to the platform & architecture flags): electron-packager .