DeskGap跨平臺桌面應(yīng)用開發(fā)框架
DeskGap 是一個使用現(xiàn)代 Web 技術(shù)(JavaScript, HTML, CSS)的跨平臺桌面應(yīng)用開發(fā)框架。
為了保證原生兼容性和壓縮體積大小,DeskGap 捆綁了一個 Node.js 運(yùn)行時,并將 HTML 渲染的工作留給了系統(tǒng)的 Webview。
受支持的平臺
- Mac OS X Yosemite (version 10.10) 或更高版本
- Windows 10 October 2018 Update (version 1809) 或更高版本
- Linux x86_64 with webkit2gtk installed, tested on:
- Ubuntu 18.04.2 with
libwebkit2gtk-4.0-37 2.22.6 - openSUSE Leap 15.0 with
libwebkit2gtk-4_0-37 2.20.2
使用示例代碼
為 app 創(chuàng)建一個 Node.js 包
hello-deskgap/ ├── package.json ├── index.js └── index.html
package.json 指向應(yīng)用程序的目錄文件,并提供啟動應(yīng)用程序的腳本:
{
"name": "hello-deskgap",
"main": "index.js",
"scripts": {
"start": "deskgap ."
}
}
index.js 會創(chuàng)建一個窗口用于渲染 HTML 頁面:
const { app, BrowserWindow } = require('deskgap');
app.once('ready', () => {
const win = new BrowserWindow();
win.loadFile('index.html');
});
index.html 是被渲染的頁面:
<!DOCTYPE html> <html> <head><meta charset="utf-8" /><title>Hello DeskGap</title></head> <body><h1>Hello DeskGap</h1></body> </html>
評論
圖片
表情
