new BrowserWindow({
width: 800,
height: 600,
webPreferences:{
nodeIntegration:true,
contextIsolation: false
node-serialport 是一个 Node.js 的包,用来对串口数据进行读写操作。基本示例代码:var SerialPort = require("serialport").SerialPort
var serialPort = new SerialPort("/dev/tty-usbserial1", {
baudrate: 57600
}, false); // this is the openImmediately flag [default is true]
serialPort.open(function (error) {
if ( error ) {
console.log('failed to open: ' error);
} else {
console.log('open');
serialPort.on('data', function(data) {
console.log('data received: ' data);
serialPort.write("ls\n", function(err, results) {
console.log('err ' err);
console.log('results ' results);
});罗列所有串口:var serialPort = require("serialport");
serialPort.list(function (err, ports) {
ports.forEach(function(port) {
console.log(port.comName);
console.log(port.pnpId);
console.log(port.manufacturer);
});串口配置:baudRatedataBitsstopBitsparityrtsctsxonxoffxanyflowControlbufferSizeparserencodingdataCallbackdisconnectedCallbackplatformOptions - sets platform specific options, see below.目前已有很多项目在使用这个包进行串口处理:Johnny-Five - Firmata based Arduino Framework.Cylon.js - JavaScript Robotics, By Your Command.node-l8smartlight (source) A node library to control the L8 Smartlight via Bluetooth or USB portfirmata Talk natively to Arduino using the firmata protocol.tmpad source - a DIY midi pad using infrared, arduino, and nodejs. Videoduino - A higher level framework for working with Arduinos in node.js.Arduino Drinking Game Extravaganza - AKA "The Russian" a hexidecimal drinking game for geeks by Uxebu presented at JSConf EU 2011.Arduino controlling popcorn.js - Controlling a popcorn.js video with an Arduino kit.Robotic JavaScript - The first live presentation of the node-serialport code set as presented at JSConf EU 2010.devicestack - This module helps you to represent a device and its protocol.reflecta A communication protocol that combines Arduino Libraries and NodeJS into an integrated system.rc4pt-node - Control Popcorntime with an
我仅使用Mac版本,这意味着要测试Windows和Linux版本。
请注意,该项目仍在积极开发中,许多功能或特性尚未实现,并且某些部分仍存在问题。
由于这是我的第一个前端项目,因此可能会有一些不良做法,但我想使Dockeron更好。 这就是为什么我会真正感谢您和社区的帮助。
欢迎公关和。
待办事项与进度
请参考 。
确保已安装Node.js(建议使用node@^6.5.0或更高版本)。
将存储库克隆到您的计算机(或将其分叉到您的github帐户,然后从那里克隆)
git clone git@github.com:dockeron/dockeron.git
cd dockeron
让分支develop
安装所有依赖项,然后npm run dev
npm install
npm run dev
(Web应用程序)
(Web应用程序)
这个项目是从产生的。
为什么Neutralinojs更适合轻量级应用程序? - 证明
在评估框架时,将其与Electron和NW.js进行了比较,并考虑了磁盘消耗,内存消耗,开发工作流程的易用性和可移植性。
请注意,以下比较数据可能与Neutralinojs,NW.js和Electron的最新版本不匹配。 该基准测试于2018年完成。
在Linux和Windows的每个框架中都使用简单的Hello World类型的应用程序进行评估。
图1:在Linux上分别使用Electron,NW.js和Neutralino编写的示例跨平台应用程序。 图2:分别在Windows上使用Electron,NW.js和Neutralino编写的示例跨平台应用程序。
操作系统详细信息
Ubuntu 18.04.1 LTS
Windows 10企业版
1.磁盘消耗
节点Webkit
Linux
Zipped SD
一个使用Electron+Node+Vue+ElementUI+Highcharts开发的舆情监控客户端,支持windows , mac多平台
Electron-vue文档 Electron-vue //simulatedgreg.gitbooks.io/electron-vue/content/cn
# install dependencies
yarn install
# serve with hot reload at localhost:9080
yarn run dev
# build electron application for
NodeJS Native Module Rebuild - remark
编译环境: VC 2017 Building Tool+ Python 2.7.13 x64 + NodeJS LTS 6.11.0, 确保node.exe、python.exe和npm 在PATH路径内
一、Init Electron 项目文件 package.json{
"name": "electron-ui-
关于electron的preload.js的编写,我可以为您提供一些基本的信息和建议。preload.js是一个在渲染进程中运行的脚本,它可以在渲染进程和主进程之间建立一个桥梁,使得渲染进程可以访问主进程的API和功能。在编写preload.js时,您需要注意以下几点:
1. preload.js应该放置在您的应用程序的根目录下的某个子目录中,例如app/preload.js。
2. preload.js应该使用node.js的模块系统来导入和导出模块。您可以使用require()函数来导入模块,使用module.exports来导出模块。
3. preload.js应该在您的应用程序的main.js文件中被加载。您可以使用webPreferences.preload选项来指定preload.js的路径。
4. preload.js应该只包含与渲染进程相关的代码。您应该避免在preload.js中包含任何与主进程相关的代码,以确保安全性和稳定性。
希望这些信息对您有所帮助。如果您有任何其他问题,请随时问我。