DeskGap - 跨平台桌面应用开发框架


MIT
跨平台
C/C++

软件简介

DeskGap 是一个使用现代 Web 技术(JavaScript, HTML, CSS)的跨平台桌面应用开发框架。

为了保证原生兼容性和压缩体积大小,DeskGap 捆绑了一个 Node.js 运行时,并将 HTML 渲染的工作留给了系统的 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 创建一个 Node.js 包

hello-deskgap/
├── package.json
├── index.js
└── index.html

package.json 指向应用程序的目录文件,并提供启动应用程序的脚本:

{
  "name": "hello-deskgap",
  "main": "index.js",
  "scripts": {
    "start": "deskgap ."
  }
}

index.js 会创建一个窗口用于渲染 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>