electron

Handling config files with webpack

社会主义新天地 提交于 2019-12-07 00:37:02
问题 I have an electron app that I'm building with webpack 2. I have a config file that I'm including like a normal webpack resource: config.js: export default { config1: 1, config2: 2 } main.js: import config from '../some/path/config'; console.log(config.config1); The config file code ends up in my bundle.js file as you would expect. The problem is that the point of config files is that you can change them after deployment. This set up requires me to re-webpackify everything if I want config

Adding Apple in-app purchase to Electron HTML/JS app

你说的曾经没有我的故事 提交于 2019-12-06 17:25:25
问题 Is there a way to add Mac App Store in-app purchase to Electron HTML/JS application? There are app store modules for Phonegap, Nativescript, ImpactJS etc but I can't seem to find anything for Electron or pure JS. 回答1: As suggested in one of the similar GitHub issues, you can try out customising nodobjc module. 回答2: A Node.js module for in-App-Purchase for iOS, Android, Amazon and Windows. https://github.com/voltrue2/in-app-purchase 回答3: From what I can see on this post, no one has really

Using SerialPort in Electron with Angular fails at build

拈花ヽ惹草 提交于 2019-12-06 16:10:46
问题 I recently began to experiment with Electron and SerialPort and hit a little snag when adding Angular (7+) in the mix. So here's the problem: I run the typical angular CLI commands to generate to the app. I add electron and electron-rebuild as dev dependencies. Then add SerialPort as a dependency. Inside my app.component.ts - import { Component, OnInit } from '@angular/core'; import * as SerialPort from 'serialport'; @Component({ selector: 'app-root', templateUrl: './app.component.html',

Angular & Electron - IPC communication between main & render processes

六月ゝ 毕业季﹏ 提交于 2019-12-06 14:43:17
There are small model: export class SettingsModel { DbFileName: string; } Main process: ipcMain.on('getSettings', function(event) { event.sender.send('resultSettings', 'Test settings'); }); IpcService: import { Injectable } from '@angular/core'; import { ElectronService } from 'ngx-electron'; @Injectable() export class IpcService { constructor(private _electronService: ElectronService) {} public on(channel: string, listener: Function): void { this._electronService.ipcRenderer.on(channel, listener); } public send(channel: string, ...args): void { this._electronService.ipcRenderer.send(channel,

How to symbolicate Electron crash log

断了今生、忘了曾经 提交于 2019-12-06 14:31:21
问题 Electron version: electron v1.6.7 Operating system: Mac OS X 10.12.1 app crashed when start Termination Signal: Segmentation fault: 11 Termination Reason: Namespace SIGNAL, Code 0xb Terminating Process: exc handler [0] Thread 0 Crashed:: CrBrowserMain Dispatch queue: com.apple.main-thread 0 com.github.electron.framework 0x000000010e73d3f2 0x10e619000 + 1197042 1 com.github.electron.framework 0x000000010e7145e5 0x10e619000 + 1029605 2 com.github.electron.framework 0x000000010e71457d

Multi Windows App Structure with Electron

 ̄綄美尐妖づ 提交于 2019-12-06 13:20:37
I'm developing a dashboard application, my intention is to have multiple windows that can be customized by selecting pre-defined window layouts. An illustrated layout would be something like this: I'm currently shooting for Electron framework. The way I'm doing it is by creating multiple BrowserWindow by capturing the screen size and calculating the windows sizes and positions. This is how I'm writing it: // app/main.js // Module to control application life. var app = require('electron').app; // Module to create native browser window. var BrowserWindow = require('electron').BrowserWindow; var

Electron dying without any information, what now?

谁说胖子不能爱 提交于 2019-12-06 12:32:53
The app I'm building, when I compile it for distribution packing it with electron-builder, every now and then, dies, showing a blank screen and a disconnected devtools: Any ideas what's going on or how to start figuring out what's happening here? Listen for the uncaughtException event and log any error that you get. This will give you insight into what is happening. Then perform any cleanup if necessary and relaunch the app if desired. This allows your app to "recover" from crashes if it is intended to be long-running. //handle crashes and kill events process.on('uncaughtException', function

how to use electron browser window inside components in angular-cli?

99封情书 提交于 2019-12-06 12:02:32
问题 Angular-cli doesn't accept the electron inside components. how to use electron browser window inside components in angular-cli? I got an error fs.existsync like this. Is there any other options to use electron with angular2 components? var electron = require('electron'); or import electron from 'electron'; Both are not working inside ts? 回答1: <!doctype html> <html> <head>   <meta charset="utf-8">   <script src="http://code.jquery.com/jquery-2.1.1.js"></script>   <title>Workdesk 2.0</title>   

Communicate between parent and child renderer process Electron JS

风流意气都作罢 提交于 2019-12-06 11:58:54
Suppose we have the following 2 BrowserWindow instances created in main process: let fooA = new BrowserWindow({width:800,height:800}); fooA.loadUrl(url.format({ pathname: path.join(__dirname, './a.html'), protocol: 'file:', slashes: true })); let fooB = new BrowserWindow({parent:fooA}); fooB.loadUrl(url.format({ pathname: path.join(__dirname, './b.html'), protocol: 'file:', slashes: true })); As you can see fooB is child of fooA Now each browsers window html file is associated with a renderer process: fooA is associated with rendererA.js and fooB is associated with rendererB.js Now let's say I

communication between 2 browser windows in electron

假装没事ソ 提交于 2019-12-06 11:24:32
I need to build an app that will span across multiple monitor screens, something like this: Electron suports multiple windows but how to comunicate between them? The main thing to remember is that in Electron, interProcess communication is done by ipcMain (in the main process) and ipcRenderer(in all the created windows). Like below: From what i've seen in the GitHub comments - direct communication between the Renderer instances is not allowed. Everything must pass trough the mainProcess. the code: mainProcess.js: function createWindow1 () { window1 = new BrowserWindow({width: 800,height: 600})