electron

Electron-builder desktop shortcut icon has to be enabled manually

这一生的挚爱 提交于 2020-02-16 10:41:24
问题 When I create and install an executable using Electron-Builder, the desktop shortcut instead displays an Electron icon. I have to manually Change Icon... for icon.ico to take effect. "target": "nsis", "icon": "assets/icon_256.ico", "nsis": { "installerIcon": "assets/icon.ico", "uninstallerIcon": "assets/icon.ico", "installerHeaderIcon": "assets/icon.ico" } // I have also tried this, which also produces the same issue. "win": { "target": "nsis", "icon": "assets/icon_256.ico" } Is there a way

electron环境搭建和使用

我们两清 提交于 2020-02-14 01:03:38
Electron 是由 Github开发的开源框架 它允许开发者使用Web技术构建跨平台的桌面应用 Electron = Chromium + Node.js + Native API 首先要先去安装node环境 官网地址:https://nodejs.org/zh-cn/ 接下来开始安装Electron cnpm install -g electron 这里已经要使用cnpm安装,如果想用npm安装会特别慢,除非翻墙 初始化一个项目 在你的桌面新建一个文件 - 创建一个html文件 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> 你好 </body> </html> 创建一个js文件 const electron = require('electron') //引入electron模块 var app = electron.app //创建electron引用 var BrowserWindow = electron.BrowserWindow; //创建窗口引用 var

Electron学习--初体验

谁说我不能喝 提交于 2020-02-12 17:02:08
Electron介绍 Electron 是一个可以让我们使用js创建桌面应用程序的框架,将 Chromium 和 Node.js 合并到同一个运行时环境中,并将其打包为Mac,Windows和Linux系统下的应用来实现跨平台,让我们可以更轻松的书写业务逻辑,而不用担心跨平台的问题。 1. electron的下载和引入 npm install electron -- save - dev npm install electron - g const { app , BrowserWindow } = require ( 'electron' ) 2. app的ready事件:main.js electorn会自动的触发ready事件 在这个事件重化工可以创建electron窗口 app . on ( 'ready' , ( ) => { createWindow ( ) // 创建窗口的函数调用 } ) 3. electron应用程序窗口的创建(createWindow函数) 引入BrowserWindow 通过BrowserWindow函数创建窗口对象 对窗口进行配置 win = new BrowserWindow ( { width : 300 , height : 490 , // 设置标题 title: 'calculator ' } ) 4.

记录 electron node-gyp报错解决

不想你离开。 提交于 2020-02-11 00:11:15
参考1:[ https://github.com/nodejs/node-gyp#installation ] 参考2:[ https://github.com/Microsoft/nodejs-guidelines/blob/master/windows-environment.md#compiling-native-addon-modules ] 1,npm install node-gyp -g // (已经装的卸载重新装) 2,npm install --global --production windows-build-tools // c++环境; 以管理员身份运行cmd [--2017]加这个参数为2017版本 3, node-gyp configure --msvs_version=2017 // 设置node-gyp使用的是2017版本,看你本装装的是哪个版本,有2015的 4,npm config set msvs_version 2017 // 设置npm对应的 windows-build-tools 版本,yarn同理吧 5,npm config set python python2.7 // 设置python版本,yarn同理吧 来源: https://www.cnblogs.com/ybixian/p/12293455.html

Atom Electron - Close the window with javascript

佐手、 提交于 2020-02-10 04:56:46
问题 I'm using Electron (formerly atom-shell) and would like to have a minimalist frame window so that the three OSX window buttons (close, maximize, minimize) are visible from within the HTML page. I set the Electron option frame to false when defining the BrowserWindow to have a chromeless, frameless window. And I thought I could handle the close button with something like this: <a btn href="#" id="close" onclick="window.top.close(); return false"></a> With no luck, sadly. Any idea how to

Atom Electron - Close the window with javascript

梦想与她 提交于 2020-02-10 04:56:30
问题 I'm using Electron (formerly atom-shell) and would like to have a minimalist frame window so that the three OSX window buttons (close, maximize, minimize) are visible from within the HTML page. I set the Electron option frame to false when defining the BrowserWindow to have a chromeless, frameless window. And I thought I could handle the close button with something like this: <a btn href="#" id="close" onclick="window.top.close(); return false"></a> With no luck, sadly. Any idea how to

Is it possible to externalize Electron menu template code?

走远了吗. 提交于 2020-02-07 02:37:07
问题 I have an Electron app with 3 windows and each window has a different menu. The menu template code for each menu is quite long and I would like to externalize it. So far nothing I have tried works. I've tried different ways to "modularize" it but got lots of errors. The approach below works to set up the menu, but none of the functions referenced in the menu work (e.g. quitApplication ). Is what I am trying to do not possible or am I just "doing it wrong"? var test = require("./app/js

using console.log() with electron

╄→尐↘猪︶ㄣ 提交于 2020-02-05 04:03:04
问题 I have seen a lot of questions from people trying to console log from the rendering process, this is NOT my problem I have console.log littering my main code and I don't see anything in my console here is my code. /* eslint-disable no-undef */ const { app, BrowserWindow, ipcMain } = require('electron'); const path = require('path'); const url = require('url'); /* eslint-enable */ let win; console.log('console log test'); function createWindow() { win = new BrowserWindow({ width: 800, height:

How to restore default window size in an electron app?

感情迁移 提交于 2020-02-04 02:29:43
问题 Is there a way to restore main window in an electron app to a certain size? To explain what I am trying to accomplish, let me give you an example: When I open Windows Explorer, it opens with a certain size and at a certain position. Then I maximize that window and close the explorer. Next time when I restart the explorer, it opens in the same state as when I closed it i.e. in maximized state. However when I click on the restore button, explorer restores to the width/height and position before