electron

electron草稿笔记

六月ゝ 毕业季﹏ 提交于 2020-01-13 04:45:24
1. Electron简介: Electron 是由 Github 开发,是一个用 HTML,CSS 和 JavaScript 来构建跨平台桌面应用程序的一个 开源库。 原理: Electron 通过将 Chromium 和 Node.js 合并到同一个运行时环境中,并 将其打包为 Mac,Windows 和 Linux 系统下的应用来实现这一目的。 现状: 目前 Electron 已成为开源开发者、初创企业和老牌公司常用的开发工具。 核心理念: 保持 Electron 的体积小 和 可持续性开发。 学习electron的基础: 电脑需要安装 nodejs,电脑上面需要安装 git,需要有 Html css js 以及 nodejs 基础。 2. Electron的安装搭建: 2.1 全局安装electron: npm install -g electron。 2.2 克隆仓库electron-quick-start项目: # 克隆示例项目的仓库 git clone https://github.com/electron/electron-quick-start # 进入这个仓库 cd electron-quick-start # 安装依赖并运行 npm install && npm start 2.3 手动创建项目: (1)、新建一个项目目录 例如:electrondemo01

Is there a way to launch a terminal window (or cmd on Windows) and pass/run a command?

江枫思渺然 提交于 2020-01-12 08:39:07
问题 Question Is it possible to do the following? open a new cmd.exe or terminal (on MacOS / Linux) window pass / run a command, e.g. cd <path> Problem I can open cmd by running this command: "$electron.shell.openItem('cmd.exe')" But shell.openItem doesn't allow to pass the arguments / commands. I tried using child_process but I couldn't make it work at all, it doesn't open a new terminal window: const { spawn, exec } = require('child_process'); spawn('C:/Windows/System32/cmd.exe'); I also tried

How to call a function/module in Electron from my webpage?

橙三吉。 提交于 2020-01-12 07:48:08
问题 I'll try to describe a minimized question in short paragraphs. In short, I want to use some logic or call some functions in my Electron App from the webpage that is in my Electron App (I am actually wrapping an electron app 'shell' for my webpage). Suppose I want to expose a function in my Electron app. Say, function printNumbers () { console.log(1) } notice that it should be located in my Electron code. Then after running my app, I'd like to call this function from my webpage(clicking a

electron, after browserify, fs.existsSync is not a function

痞子三分冷 提交于 2020-01-12 06:23:52
问题 i read a lot about browserify and electron and the gui browser issue yet there is still a problem with browserify, saying "fs.existsSync is not a function", and "required is not defined" * The full story* i created simple gui with electron , there are the package.json file, the main.js and the index.html file + 3,4 html files, where there i want to create simple "load show save window" that work with require That feature worked in the index.html file yet doesn't work properly in the load.html

electron, after browserify, fs.existsSync is not a function

空扰寡人 提交于 2020-01-12 06:22:27
问题 i read a lot about browserify and electron and the gui browser issue yet there is still a problem with browserify, saying "fs.existsSync is not a function", and "required is not defined" * The full story* i created simple gui with electron , there are the package.json file, the main.js and the index.html file + 3,4 html files, where there i want to create simple "load show save window" that work with require That feature worked in the index.html file yet doesn't work properly in the load.html

What does it mean for Electron to combine Node.js and Chromium contexts?

≯℡__Kan透↙ 提交于 2020-01-12 06:12:46
问题 In a blog post the author mentions that Electron combines Node and Chromium into a "single context" which implies that we don't have to use Browserify to transform code. I understand that one implication of Electron is you can build cross-platform desktop apps using web technologies. I also understand the reason why we're able to write to the filesystem is because Electron has Node baked in. Also, the reason we're able to use HTML/CSS/JS/DevTools is because Chromium is baked in. However, I

Electron load remote URL and load local file

六月ゝ 毕业季﹏ 提交于 2020-01-11 14:19:25
问题 I have a video installation for an art exhibition with big videos (several GBs) and a online hosted webapp. Since I want to save some bandwith during the exhibition, I would like to package the videos into an electron app, load the webpage once during startup and load the videos from the local filesystem / packaged electron app. I've already achieved to disable the webSecurity (it's fine, no one beside me runs this application) and I already get the error message in the JS console GET file://

Can we launch a node command on a mac without node installed when using electron-packager?

一笑奈何 提交于 2020-01-11 12:40:34
问题 When I package an electron app using electron-packager. The app spawns a child process which uses a 'node' command. Now if I try to launch my app in a system with no node installed on it, does the app work? I have been trying to achieve this and facing various issues, the electron community suggested me to use fork method, spawn method with 'Process.execPath' as command and also setting the ELECTRON_RUN_AS_NODE variable but nothing seems to work on my end. Now after doing all this I question

Electron 开发问题锦集

余生长醉 提交于 2020-01-10 13:53:59
一 运行调试 vscode 和 WebStorm 可以调试 新增run.js 通过node 进程调用调试 const exec = require('child_process').exec exec('electron .') 二 控制台中文乱码 在package.json中修改 命令 加入chcp 65001 && 如 "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "start": "chcp 65001 && electron ." }, 来源: CSDN 作者: ucicno000 链接: https://blog.csdn.net/ucicno000/article/details/103922179

electron安装

空扰寡人 提交于 2020-01-10 11:29:11
Electron是一个能让你使用传统前端技术(Nodejs, Javascript, HTML, CSS)开发一个跨平台桌面应用的框架。这里所说的桌面应用指的是在Windows、OSX及Linux系统上运行的程序。 呃呃,官方话不理解?好吧,说白了就是一个集成nodejs+谷歌浏览器的壳子,支持打包成在windows,OSX系统直接安装使用的桌面程序。 详细介绍看官方,来来来,开撸! 1.安装electron: git clone https://github.com/electron/electron-quick-start 2.进入electron-quick-start : cd electron-quick-start 3.安装依赖: npm install 4.运行electron: npm start (git上有资源,要是你想自己敲代码了解一下,往下看) -------------我是一条尴尬我分界线----------------------------- 1.创建文件夹helloword 2.打开终端 cd helloword 3.创建package.json npm init 4.改一下启动命令: { "name": "electron demo", "version": "1.0.0", "description": "", "main": "main.js"