clickgo-native 2.0.2 → 2.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +14 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -42,6 +42,8 @@ native.launcher(new Boot());
|
|
|
42
42
|
|
|
43
43
|
## Build a ClickGo Application as a Native Package
|
|
44
44
|
|
|
45
|
+
The application project does not need to install `electron` directly when using ClickGo Compiler to run and package it. The compiler supplies the Electron runtime. Native main-process code can use `native.getAppVersion()` to read the application's `package.json` version and `native.isPackaged()` to distinguish a packaged application from development runs. These APIs do not expose Electron to the HTML page.
|
|
46
|
+
|
|
45
47
|
Building a desktop application consists of two steps: compile the ClickGo application into a `.cga` file, then package the Native project with Electron.
|
|
46
48
|
|
|
47
49
|
Install the compiler globally first:
|
package/dist/index.d.ts
CHANGED
|
@@ -91,6 +91,16 @@ export declare function showMainForm(path: string, opt?: {
|
|
|
91
91
|
/** --- 应用启动后、网页加载成功前显示的底色 --- */
|
|
92
92
|
'background'?: string;
|
|
93
93
|
}): void;
|
|
94
|
+
/**
|
|
95
|
+
* --- 获取当前桌面应用的版本,来自应用 package.json ---
|
|
96
|
+
* @returns 应用版本
|
|
97
|
+
*/
|
|
98
|
+
export declare function getAppVersion(): string;
|
|
99
|
+
/**
|
|
100
|
+
* --- 判断当前应用是否为已打包运行 ---
|
|
101
|
+
* @returns 是否已打包
|
|
102
|
+
*/
|
|
103
|
+
export declare function isPackaged(): boolean;
|
|
94
104
|
/** --- 用户调用运行 boot 类 --- */
|
|
95
105
|
export declare function launcher(boot: AbstractBoot): void;
|
|
96
106
|
/**
|
package/dist/index.js
CHANGED
|
@@ -511,6 +511,20 @@ function resetMainSession() {
|
|
|
511
511
|
},
|
|
512
512
|
};
|
|
513
513
|
}
|
|
514
|
+
/**
|
|
515
|
+
* --- 获取当前桌面应用的版本,来自应用 package.json ---
|
|
516
|
+
* @returns 应用版本
|
|
517
|
+
*/
|
|
518
|
+
export function getAppVersion() {
|
|
519
|
+
return electron.app.getVersion();
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
* --- 判断当前应用是否为已打包运行 ---
|
|
523
|
+
* @returns 是否已打包
|
|
524
|
+
*/
|
|
525
|
+
export function isPackaged() {
|
|
526
|
+
return electron.app.isPackaged;
|
|
527
|
+
}
|
|
514
528
|
/** --- 用户调用运行 boot 类 --- */
|
|
515
529
|
export function launcher(boot) {
|
|
516
530
|
(async function () {
|