electron

child_process.fork not starting an express server inside of packaged electron app

自古美人都是妖i 提交于 2019-12-04 17:40:25
问题 I have an electron app where I need not only to run the interface to the user but also start an express server that will serve files for people connected through the network. I have everything working if I start both electron and the express server normally, but I'm pretty confident that I will need the server running in a different thread to avoid slugish interface and even problems with the server. For that matter I tried to run my express server using the child_process.fork and it worked

Showing window after it is fully loaded

三世轮回 提交于 2019-12-04 16:29:26
问题 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 =

How to properly run a Rails app inside Electron?

守給你的承諾、 提交于 2019-12-04 15:49:10
I am very new to Electron, just tried to follow the Documentation. I was able to run a html in Electron and it worked fine. Then I tried to load a Rails app with BrowserWindow loadUrl, but the javascripts of the app are not working inside Electron. My main is this index.js here: var app = require ('app') var BrowserWindow = require ('browser-window') app.on('ready', function(){ var mainWindow = new BrowserWindow({ width:1115, height:945 }) mainWindow.loadUrl('http://my-app-at-heroku.herokuapp.com') }) Running the server in my machine and loading http://localhost:3000 has the same behavior. The

Find OS username in NodeJS

放肆的年华 提交于 2019-12-04 15:13:15
问题 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... 回答1: 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

Electron-packager: can not locate local db file after packing

断了今生、忘了曾经 提交于 2019-12-04 14:53:19
Background: In my app, I have a local DB file, named example.db which is read by the main.js . The project structure and part of my main.js program is shown below. Project folder architecture main.js const { app, BrowserWindow, dialog, Menu } = require('electron') const fs = require('fs') const path = require('path') const sqlite3 = require('sqlite3').verbose() // load dataBase let dbFile = 'app/db/example.db' const db = new sqlite3.Database(dbFile) Package.json { "name": "Example", "version": "1.0.0", "description": "", "main": "./app/main.js", "scripts": { "postinstall": "install-app-deps",

Get selected text from electron webview

╄→гoц情女王★ 提交于 2019-12-04 14:40:49
问题 How to get the selected text from a webview in an electron application? I am using Angular with Electron. So I have a component which has a webview: <webview id="foo" attr.src={{activeUrl}} style="height: 600px"></webview> This is what I use for getting the selected text: let rightClickPosition = null; const menu = new Menu(); const menuItem = new MenuItem({ label: 'Get selected text', click: () => { // does not work for selected text in webview console.log(window.getSelection().toString());

How to hide the API key in my Electron application?

假装没事ソ 提交于 2019-12-04 13:38:15
问题 I'm building an Electron application that uses Google's YouTube Data API v3. For accessing the API, I decided to use the standard API key (instead of OAuth, since I am not going to be accessing any personal data). But the problem is, I cannot hide the API key in my app, and I also cannot use referrer restrictions (referrer restrictions allow you to filter which web sites can use your API key (by HTTP address)), since this is an Electron app. So basically, if someone looks at the source code

Nodejs (Sync) cannot find fibers binaries

不问归期 提交于 2019-12-04 13:31:34
问题 I've seen similar questions but no real solution that worked for me yet (most users just reinstall fibers or meteor (I'm not using meteor)). I've added the nodejs module Sync to my nodejs 0.12.6 project. It's dependency is the Fibers module that got installed automatically with Sync. Now I wanted to load Sync via require, but it fails with the message ... /win32-x64-v8-4.3/fibers.node not found And it's correct: In sync/node_modules/fibers/bin/ is no directory named win32-x64-v8- 4.3, only

How to detect desktop idle time from an Electron app?

爱⌒轻易说出口 提交于 2019-12-04 13:29:28
问题 I need my Electron app to respond to the user becoming idle (no mouse or keyboard inputs to any program on the OS) for a certain amount of time. How can I trigger a function based on such idle time data? 回答1: You can always detect idle times on Linux by using XScreenServer, GetLastInputInfo on Windows and CGEventSourceSecondsSinceLastEventType on Mac I've published desktop-idle using these API's, you can check the source code https://github.com/bithavoc/node-desktop-idle UPDATE: Electron 3

“Uncaught TypeError: React.createClass is not a function” in Render.js file (electron app)

蓝咒 提交于 2019-12-04 13:21:50
问题 I'm new to react.js and I am trying to get this code to replace one line in an html file inside an electron app with whatever is in return inside the MainInterface variable This is my Render.js File var React = require('react'); var ReactDOM = require('react-dom'); var $ = jQuery = require('jquery'); var bootstrap = require('bootstrap'); //var createReactClass = require('create-react-class'); var MainInterface = React.createClass({ render: function() { return( <h1>SUCCESSSSSSSSSSS</h1> ); }/