electron

jQuery on electron main process

丶灬走出姿态 提交于 2019-12-12 04:44:18
问题 How I can use jQuery on electron main process? It seems every example I find is for renderer process. Example I want to create a util that will be used by the main process, that will fetch data from an api using get. Then using $.get makes an error that get is not a function . Thanks. 回答1: jQuery is a JS library for the browser, eg DOM manipulating, etc. You shouldn't use that in the main process, since the main process is running in NodeJS. It's hard to propose a solution without knowing

How do I search text in a single page reactjs/electron application

笑着哭i 提交于 2019-12-12 04:24:37
问题 I have a react electron application and I want to add ctrl+f functionality to it. I added a globalshortcut that responds to ctrl+f and shows a text box, then on the textbox, I gave it a listener for changes which calls window.find(). Unfortunately this never searches in the page, it always returns false. I'm assuming this has something to do with the react components, is there a way to search and highlight text of all the components on the page? code: mainWindow.on('focus', () => {

electron certificates network

你。 提交于 2019-12-12 04:24:24
问题 I am trying to write a simple electron app to interface with a REST server. The server doesn't have the appropriate certificates. When I try to make a 'GET' request (using fetch()), I get the following error message: Failed to load resource: net::ERR_BAD_SSL_CLIENT_AUTH_CERT Fixing the certs is not currently an option. I tried to use the 'ignore-certificates-error' flag (see below). It seems like it should allow me to skip over this error, but it doesn't. var electron = require('electron');

Node.js module lookup in Electron+Angular 2 & TypeScript application

余生长醉 提交于 2019-12-12 04:23:57
问题 I'm developing an Electron application with Angular 2. I followed this tutorial to initially setup the environment. My setup is a bit more complicated but in general is very similar. tsconfig.json : { "compilerOptions": { "target": "es5", "module": "commonjs", "moduleResolution": "node", "sourceMap": true, "emitDecoratorMetadata": true, "experimentalDecorators": true, "removeComments": false, "noImplicitAny": false }, "exclude": [ "node_modules", "app/node_modules", "dist" ] } systemjs.config

Where to place electron-cookies?

扶醉桌前 提交于 2019-12-12 04:03:11
问题 Here it basically says: In your app's renderer code, just require this package.... I don't know where to place it. When i put it in main.js my app just won't start anymore. I installed it correctly since its in my node_modules folder. Any ideas? My main.js: 'use strict'; const electron = require('electron'); // Module to control application life. const app = electron.app; // Module to create native browser window. const BrowserWindow = electron.BrowserWindow; // Keep a global reference of the

Angular2 / Electron application using electron API within the angular2 ts files

好久不见. 提交于 2019-12-12 03:46:08
问题 I have setup an angular2 / Electron app similar to the explanation in this video : https://www.youtube.com/watch?v=pLPCuFFeKOU. The project I am basing my code on can be found here : https://github.com/rajayogan/angular2-desktop I am getting the error: app.ts:16Uncaught TypeError: Cannot read property 'on' of undefined When I try to run this code: import { bootstrap } from '@angular/platform-browser-dynamic'; import { Component } from '@angular/core'; import { MenuComponent} from './menu';

How to use electron-packager to create a custom icon in Linux?

只愿长相守 提交于 2019-12-12 03:35:14
问题 Following this tutorial: https://www.youtube.com/watch?v=dz5SnmBzBXc I did this: electron-packager . MyApp --platform=linux --arch=x64 --version=0.37.2 && cp icon.png MyApp-linux-x64/resources/atom.png The icon is saved into the resources folder, but the icon doesn't show in my Ubuntu left panel (I just see the default cog). What the correct way of setting up the icon for Linux? EDIT: I also tried this: var mainWindow = new BrowserWindow({ icon: 'file://' + __dirname + '/resources/atom.png',

Setting windows to energy save mode using Node.js

随声附和 提交于 2019-12-12 03:30:00
问题 I'm developing an app using Electron and Node.js and is supposed to set the laptop (running windows 10) to energy saving mode when needed, is this possible to do this using technologies of Node.js and electron? Thanks 回答1: You can call the WinAPI function SetSuspendState using the node-ffi library. First, install the library: npm install ffi --save Then, you can use this code: var ffi = require('ffi'); var powrprof = ffi.Library('powrprof.dll', { SetSuspendState: ['int', ['int', 'int', 'int']

Electron + renderer process + websocket issue (bounty for the solution!)

心不动则不痛 提交于 2019-12-12 01:28:49
问题 I'm creating an Electron application that uses websocket to communicate to a client application, but I'm experiencing an issue: The client can connect to the server via websocket but when it comes to sending messages from the client to the server, it does not work. It seems that the server is just simply not receiving the messages. Server-side: import http from "http"; import * as WebSocket from "ws"; const port = 4444; const server = http.createServer(); const wss = new WebSocket.Server({

How to send search text to findInPage in Electron

故事扮演 提交于 2019-12-11 19:45:21
问题 I try using contents.findInPage. I have code in index.js: const { webContents } = require('electron') webContents.on('found-in-page', (event, result) => { if (result.finalUpdate) webContents.stopFindInPage('clearSelection') }) const requestId = webContents.findInPage('api') console.log(requestId) And code in component: searchText(value){ this.query = value; if (this.query.length > 0) { ipcRenderer.send('api', this.query); } } I wrote this code on the example of this answer. But function find