electron

Modules not found when using express

元气小坏坏 提交于 2019-12-12 20:06:51
问题 I want to expose REST service in electron app and I want to use expressJS with electron, as tutorial states I added express and @types/express. I tried to expose a "get " but when I build and run it throws the following. Ran with ng build --prod ERROR in ./node_modules/cookie-signature/index.js Module not found: Error: Can't resolve 'crypto' in 'app\node_modules\cookie-signature' ERROR in ./node_modules/etag/index.js Module not found: Error: Can't resolve 'crypto' in 'app\node_modules\etag'

Electron App程序自动更新版本管理electron-release-server服务器搭建教程

白昼怎懂夜的黑 提交于 2019-12-12 20:04:51
【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>> 今天,由于小伙伴需要一个Electron 编写的App程序的自动升级功能;博主就自己动手搭建了一个electron-release-server以提供APP程序的发布管理服务,此处留下笔记以供后用。 环境:centos 7+ 1.postgresql (1).下载 wget https://ftp.postgresql.org/pub/source/v9.6.3/postgresql-9.6.3.tar.gz (2).配置用户和组 groupadd postgres useradd postgres -g postgres passwd postgres 设置的用户名和密码需要和数据库的用户名密码一致 (3).环境准备 yum install -y perl-ExtUtils-Embed readline-devel zlib-devel pam-devel libxml2-devel libxslt-devel openldap-devel python-devel gcc-c++ openssl-devel cmake gcc* readline-devel (4).权限配置 mkdir /opt/postgres chown -R postgres:postgres /opt/postgres/ (5)

Electron: prevent / cancel page navigation

冷暖自知 提交于 2019-12-12 19:50:18
问题 Is there anyway to prevent or cancel page navigation in electron? win.webContents.on('did-start-loading', function(event, url) { if (event.sender.getURL().startsWith('http://xyz')) { event.preventDefault(); } }) The code above doesn't work since the event handler gets executed while the page keeps on navigating away. Similarly, I'd also like to do the same for event 'did-get-redirect-request', to prevent certain redirect from happening. Many thanks 回答1: You can use the will-navigate event to

make document.execCommand('insertText', false, 'message') work with draftjs?

◇◆丶佛笑我妖孽 提交于 2019-12-12 19:40:12
问题 I'm working on an application which needs to insert text into a contenteditable="true" div (a Draftjs based textfield to be precise). Now I am aware that Draft.js uses react and that it should be used that way, but in this case, the application already exists and this is a third party electron app that works with it. I'm working on in-line notification replying on macOS, so I need that reply text to be pasted inside the draftJS field, however, when I do so using: document.querySelector('div

How to include javascript for both main process and renderer

。_饼干妹妹 提交于 2019-12-12 18:21:31
问题 In an electron project, I've found that if I put javascript with module.exports in the node_modules folder I can access it from both the main process and renderer process by require() from either place. Is this the correct method of accessing common javascript, or is there a different best-practice? Assume there's no particular reason it needs to be a node module- like say a global configuration object. Similarly- aside from a slightly messier folder structure, are there any practical

Using node require with Electron and Webpack

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-12 15:24:33
问题 I am building a project with Electron, and using Webpack to build the (Angular 2) render process app. In this app, I need to dynamically require some files at run-time which do not exist at build-time. The code looks something like this: require("fs").readdirSync(this.path).forEach(file => { let myModule = require(path.join(this.path, file)); // do stuff with myModule }); The problem is that the Webpack compiler will convert the require() call to its own __webpack_require__() and at run-time,

Adding electron application path to user environment variables after install

岁酱吖の 提交于 2019-12-12 15:07:21
问题 Problem description: I have an electron application and I need to add the application to user environment variables after users install my application, so that they can run commands like this my-electron-app <command> [<args>] in the terminal to start my electron application. I could not find a way to do this programmatically using nodejs. VSCode, hyper and atom are the three electron apps ( that I know of ) who add the application path to user environment variables after users install the

IPC Communication not working between Electron and window

纵然是瞬间 提交于 2019-12-12 13:02:30
问题 I am trying to write my first Electron app based on Electron Boilerplate. I am trying to send a simple message from the main Electron process into my window but it seems that the message is not getting send. The main code I've impmeneted is as follows background.js ( main Electron process) // Window setup app.on("ready", () => { mainWindow = new BrowserWindow({ width: 1000, height: 300, frame: false, resizable: false, transparent: true, }); mainWindow.setIgnoreMouseEvents(true); mainWindow

TypeScript: how to NOT use relative paths to import classes?

不羁的心 提交于 2019-12-12 12:08:37
问题 I am currently working on an Electron app using TypeScript and Angular2, for which I have created many different classes, all in separate files. In order to make the refactoring of my app easier, I would like to not have to use the relative path when importing those classes. Right now, to import them, I use this syntax: import {Trigger} from './../../trigger/ts/trigger.component'; What I would like to do is use a syntax that looks like this: import {Trigger} from 'trigger.component'; Is that

NodeRT: could not find assembly

两盒软妹~` 提交于 2019-12-12 10:46:36
问题 I am writing an electron app with electron-windows-notifications which is dependant on NodeRT. As I try to install my project, I get following error for each of @nodert-win10 dependencies: > if not defined npm_config_node_gyp (node "C:\Applications\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild --msvs_version=2015 ) else (node "" rebuild --msvs_version=2015 ) Building the projects in this solution one at a time. To enable parallel build, please