前言
Electron是基于 Node.js 和 Chromium 的,可以把前端代码打包成桌面应用的工具,使得JavaScript, HTML和CSS跨平台部署。 但是由于各种原因,不够精巧,体积太大,资源独占,发布不便,源码保护做的不好等等,所以不适用于某些场合。 最近要做嵌入式上位机开发,于是挨个测试一下。
替代品一览
发现 electron 其实有超多替代品的,来源参考Electron替代一览 :
C# (.Net)
名称 备注 Orleans 分布式,云服务可用于物联网,更新不算勤 Avalonia 更多功能需要付费 Uno (Pixel-Perfect Multi-Platform Applications with C# and WinUI) Chromely (Build HTML Desktop Apps on .NET/.NET Core/.NET 5 using native GUI, HTML5, JavaScript, CSS)
C++
Dart
Go
Java
JS
名称 备注 NW.js (Similar to electron, provides Source code protection ) DeskGap (bundles a Node.js runtime and leaves the HTML rendering to the operating system‘s webview) Neutralinojs (chromium module is replaced with either user’s web browser or built-in browser component. Node run-time is replaced with a lightweight web server which exposes native OS functionality) Proton Native (does the same to desktop that React Native did to mobile, based on https://github.com/parro-it/libui-node) React Native Desktop (Cross-platform React Native Desktop port based on Qt framework) Vuido (creating native desktop applications based on Vue.js, based on https://github.com/parro-it/libui-node) NodeGui (powered by Qt5, [NodeGui-React] reactxp (library for cross-platform app development using React and React Native) quasar (Vue.js based framework, which lets web developer to quickly create responsive websites/apps) nidium electrino graffiti Tauri Sciter.JS (Is a 5MB HTML/CSS/JS (ES6) runtime aimed as a direct Electron replacement)
Python
其他的就暂且不说了。
sciter测试
在官网 下载sciterJS的sdk,阅读doc目录下的文档。 文档不支持中文,开发需要对照他的文档来写。 不保护源码,支持C API,所以在跨平台环境下效果不错。 使用的quickJS作为引擎,轻量。 官方给的例子是windows平台的。linux下13~19MB。
"bin/windows/x32/scapp.exe" "samples/calc/index.html"
如要使用,最好后台用c开发。 看了一下对React是可以支持的。