electron

JavaScript: How to stringify a class, after calling new

浪子不回头ぞ 提交于 2019-12-11 08:14:13
问题 TL;DR: I need to inject some JavaScript into a BrowserView in Electron using executeJavaScript. This code needs to be class. How can I stringify the class? I found out that you can stringify functions using + . const fn = function() { console.log('Hello'); }; const functionToText = '' + fn; console.log(functionToText); // function() { // console.log('Hello'); // } */ But my problem is, how can you stringify classes? I need the string version of the following object created from the class with

Electron: Minimize the application when launched after computer is restarted

陌路散爱 提交于 2019-12-11 08:07:39
问题 I am using node-auto-launch to launch my application after computer is restarted. This application is only for windows. I want this application by default to be launched minimized as it works in the background. HOw can I achieve this? let bizAnalystAutoLauncher = new AutoLaunch({ name: 'BizAnalystDesktop' }); bizAnalystAutoLauncher.enable(); bizAnalystAutoLauncher.isEnabled() .then(function (isEnabled: boolean) { if (isEnabled) { return; } bizAnalystAutoLauncher.enable(); }) .catch(function

Javascript const declaration with braces

谁说胖子不能爱 提交于 2019-12-11 08:03:00
问题 Electron's documentation (for example http://electron.atom.io/docs/api/browser-window/) says to import some features using a destructuring statement: const {BrowserWindow} = require('electron') This works when running the code in Electron but Jasmine and Visual Studio* claim that the "{" is a syntax error. What is the correct usage? *The code is actually written in Typescript (1.8 targeting ES2015) but the transpiled code in JS is identical in this case. 回答1: This code is valid ES6/ES2015,

Node.js child process with detached option

邮差的信 提交于 2019-12-11 07:54:30
问题 I am creating an electron desktop app, and I have code use spawn() with option detached: true. My purpose is to let the child process keep running even when the parent process terminated. const spawn = require('child_process').spawn; const ls = spawn('ls', ['-lh', '/usr'], { detached: true }); ls.stdout.on('data', (data) => { console.log(`stdout: ${data}`); fs.writeFileSync('path-to-test.txt', 'stdout'); }); ls.stderr.on('data', (data) => { console.log(`stderr: ${data}`); fs.writeFileSync(

Electron v1.7: Close, Maximize and Maximize

牧云@^-^@ 提交于 2019-12-11 07:42:20
问题 I am trying to build a Simple App having Close, Maximize and Minimize buttons. The problem with the application is that the Close, Maximize and Minimize are not working properly. The console.log() when the buttons are clicked, is functioning properly and displaying the proper messages, however, it is not performing the actual Close, Maximize and Minimize operations. Also, not that in the CSS, I have added -webkit-app-region: drag; for the header but added -webkit-app-region: no-drag; for

catch the file when we “open with” file to a electron app

不想你离开。 提交于 2019-12-11 07:18:19
问题 Catch the file when we "open with" file to a electron app I have created media player in electron and want any media file to play inside my app whenever i right-click and open with my-app, should play the video, which not happening now. Technically, i want to catch the file and play it, whenever its open-with my-app. I have created media player in electron and want any media file to play inside my app whenever i right-click and open with my-app, should play the video, which not happening now.

Two Way Data Binding Angular 2 in Electron not working

倾然丶 夕夏残阳落幕 提交于 2019-12-11 07:11:42
问题 I used electron-forge to create a new electron project that uses angular 2 npm install -g electron-forge electron-forge init -t angular2 Then I added @angular/forms yarn add @angular/forms Then I edited the app.components.ts file to look like this import { NgModule } from '@angular/core'; import {FormsModule} from '@angular/forms'; import { BrowserModule } from '@angular/platform-browser'; import { Component, OnInit } from '@angular/core'; @Component({ selector: 'App', template: `<div> <h2

electron nodejs with c++ class in backend

匆匆过客 提交于 2019-12-11 06:56:37
问题 I am fairly new to web development other than basic HTML5 website creation, I somehow understand the general structure but I still cannot understand fully especially electron and nodejs. The other day I was going to create a webapp, which is similar to wysiwyg text editor but talks in between the browser (HTML5/js) with the backend (c++ script). What I first tried, was to have a c++ hello world script, which can be executed from the webapp built upon electron. I was able to run .exe as child

Error in electron-rebuild serialport on Windows

寵の児 提交于 2019-12-11 06:52:07
问题 I am developing a project with Electron and serialport. The serialport library doesn't work automatically. Searching in the Readme.md, I figure out that is needed to recompile the library for the NodeJS version of electron, using the electron-rebuild library. (Inserting this script in the package.json: "install": "electron-rebuild" ). The electron-rebuild require a python installed in the computer, so I have installed through windows-build-tools. (installed globally) So now when I run the

Using electron as a npm dev dependency on Ubuntu

Deadly 提交于 2019-12-11 06:50:26
问题 On Ubuntu 17.10 I'm installing and running electron like this: ole@mki:~/angular-electron$ npm i --save-dev electron > electron@1.7.12 postinstall /home/ole/angular-electron/node_modules/electron > node install.js npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.1.3 (node_modules/fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"}) + electron@1.7.12 updated 1