electron

Change Electron's menu item's status dynamically

為{幸葍}努か 提交于 2019-12-22 05:52:31
问题 Like in any standard native application, also my electron's application needs to change the status (enabled/dsabled) of several menu item, based on live usage results. I am setting up my menu in main.js: function createWindow () { ... ... require('./menu/mainmenu'); } The MenuItem I need to change is defined in mainmenu: { label: "Show Colors", accelerator: 'CmdOrCtrl+1', enabled: getStatus(), click() {getWebviewWebContents().send('switchToColors');} }, where getStatus() is function returning

Is it possible to build Electron Apps on Mac Pro? Doesn't seem like it due to Bizarre GPU issue

丶灬走出姿态 提交于 2019-12-22 04:43:12
问题 I tried to pull and tried to build two different bootstrap repos for Electron apps: https://github.com/pastahito/electron-react-webpack https://github.com/duskload/react-electron-webpack Followed the instructions only to be getting this error while starting the app using npm start AVDCreateGPUAccelerator: Error loading GPU renderer I am using a Mac Pro with macOS Mojave 10.14.5. From what I read: Mac Pros (2013 model)'s GPU architecture stumbles Electron/Chromium [for reasons beyond me]. I do

Is it possible to build Electron Apps on Mac Pro? Doesn't seem like it due to Bizarre GPU issue

老子叫甜甜 提交于 2019-12-22 04:43:06
问题 I tried to pull and tried to build two different bootstrap repos for Electron apps: https://github.com/pastahito/electron-react-webpack https://github.com/duskload/react-electron-webpack Followed the instructions only to be getting this error while starting the app using npm start AVDCreateGPUAccelerator: Error loading GPU renderer I am using a Mac Pro with macOS Mojave 10.14.5. From what I read: Mac Pros (2013 model)'s GPU architecture stumbles Electron/Chromium [for reasons beyond me]. I do

How to show an open file native dialog with Electron?

陌路散爱 提交于 2019-12-22 04:36:47
问题 I am trying to add functionality to my Electron app that will allow users to open a file in the app, specifically plain text files. After looking at the Electron documentation, I found this page. I added this code to my app.js file, which I linked to in my index.html . var fs = require('fs'); var dialog = require('electron'); $openFile = $('#openBtn'); $editor = $('#editor'); $openFile.click(function(){ dialog.showOpenDialog(function(fileNames) { if (fileNames === undefined) return; var

How to protect source code in electron project

自古美人都是妖i 提交于 2019-12-22 04:33:18
问题 I build my first electron app but now I wonder how to protect the source code to be view by other developers. The official doc says : To protect your app's resources and source code from the users, you can choose to package your app into an asar archive with little changes to your source code. So far the best I can think of is uglyfy the source-code and package it into a asar file, but the asar file is just an archive and can be easily be extracted. I don't see how having that make your code

Open local file in electron and render in wavesurfer.js

青春壹個敷衍的年華 提交于 2019-12-22 03:50:08
问题 I'm working on an app built with electron, it should work with wavesurfer.js to display a waveform representing the audio file. However, I'm having trouble opening the file using the fs module and pushing the file content to wavesurfer via a Blob. The file loads and everything seems to work but when decoding wavesurfer says Error decoding audiobuffer . Two things I thought maybe could influence this: The fs.readFile function takes an encoding as second parameter The Blob constructor takes an

Electron app name doesn't change

ε祈祈猫儿з 提交于 2019-12-21 23:20:21
问题 i'm packaging my application using electron-packager but isn't changing its name, and still display "Electron". it's supposed to use the productName in my package.json but it doesn't change. even if i made an installer, the name of the app installed, shortcut and process still is Electron i've read that maybe the problem is electron-prebuilt but i didn't have it as a dependency on my project. Any idea what is wrong? Edit: reading more on the documentation of electron-packager there's an

Invoking a node module from react component

人走茶凉 提交于 2019-12-21 16:19:12
问题 How do I use Node Modules for example 'lwip' in React component ? This is for an electron application. Updating the question with Code: This is the react component from which I am trying to invoke another .js file. button.js import React from 'react'; import ReactDOM from 'react-dom'; import resize from '../../node-code/process'; class Button extends React.Component{ mess(){ console.log('working'); resize(); } render(){ return <button id="imgButton" onClick={this.mess.bind(this)}>Upload Image

Very fast endless loop without blocking I/O

∥☆過路亽.° 提交于 2019-12-21 12:34:18
问题 Is there a faster alternative to window.requestAnimationFrame() for endless loops that don't block I/O? What I'm doing in the loop isn't related to animation so I don't care when the next frame is ready, and I have read that window.requestAnimationFrame() is capped by the monitor's refresh rate or at least waits until a frame can be drawn. I have tried the following as well: function myLoop() { // stuff in loop setTimeout(myLoop, 4); } (The 4 is because that is the minimum interval in

Communicate with <webview> in Electron

随声附和 提交于 2019-12-21 08:21:48
问题 I have a <webview> in my Electron app. I'd like to have safe "foreign" communication, the way I would with an iframe through postMessage . So for example: webview.executeJavaScript("window.parent.postMessage('all done!')"); Is my only choice for communication with this subwebview to turn on nodeIntegration so that I can use sendToHost ? Turning on all of nodeIntegration just for this one feature seems like overkill. 回答1: You can access Electron APIs in the webview preload script, including