clickgo-native 0.0.19 → 1.0.1
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/LICENSE +1 -1
- package/README.md +15 -18
- package/dist/index.d.ts +76 -5
- package/dist/index.js +252 -239
- package/dist/lib/fs.d.ts +1 -0
- package/dist/lib/fs.js +215 -294
- package/dist/lib/tool.d.ts +6 -0
- package/dist/lib/tool.js +10 -8
- package/dist/pre.js +3 -38
- package/package.json +7 -7
- package/dist/pre.d.ts +0 -1
- package/eslint.config.js +0 -22
package/LICENSE
CHANGED
|
@@ -186,7 +186,7 @@
|
|
|
186
186
|
same "printed page" as the copyright notice for easier
|
|
187
187
|
identification within third-party archives.
|
|
188
188
|
|
|
189
|
-
Copyright
|
|
189
|
+
Copyright 2025 MAIYUN.NET
|
|
190
190
|
|
|
191
191
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
192
|
you may not use this file except in compliance with the License.
|
package/README.md
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
# ClickGo Native
|
|
2
2
|
|
|
3
|
-
<p align="center"><img src="dist/icon.png" width="100" height="100" alt="ClickGo Native"></p>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
3
|
+
<p align="center"><img src="./dist/icon.png" width="100" height="100" alt="ClickGo Native"></p>
|
|
4
|
+
<p align="center">
|
|
5
|
+
<a href="https://github.com/maiyun/clickgo-native/blob/master/LICENSE">
|
|
6
|
+
<img alt="License" src="https://img.shields.io/github/license/maiyun/clickgo-native?color=blue" />
|
|
7
|
+
</a>
|
|
8
|
+
<a href="https://www.npmjs.com/package/clickgo-native">
|
|
9
|
+
<img alt="NPM stable version" src="https://img.shields.io/npm/v/clickgo-native?color=brightgreen&logo=npm" />
|
|
10
|
+
</a>
|
|
11
|
+
<a href="https://github.com/maiyun/clickgo-native/releases">
|
|
12
|
+
<img alt="GitHub releases" src="https://img.shields.io/github/v/release/maiyun/clickgo-native?color=brightgreen&logo=github" />
|
|
13
|
+
</a>
|
|
14
|
+
<a href="https://github.com/maiyun/clickgo-native/issues">
|
|
15
|
+
<img alt="GitHub issues" src="https://img.shields.io/github/issues/maiyun/clickgo-native?color=blue&logo=github" />
|
|
16
|
+
</a>
|
|
17
|
+
</p>
|
|
11
18
|
|
|
12
19
|
The software developed with ClickGo will run in Windows, Mac OS, Linux.
|
|
13
20
|
|
|
@@ -19,12 +26,6 @@ You can install directly using NPM:
|
|
|
19
26
|
$ npm i clickgo-native --save
|
|
20
27
|
```
|
|
21
28
|
|
|
22
|
-
Or install the developing (unstable) version for newest features:
|
|
23
|
-
|
|
24
|
-
```sh
|
|
25
|
-
$ npm i clickgo-native@dev --save
|
|
26
|
-
```
|
|
27
|
-
|
|
28
29
|
**Node**
|
|
29
30
|
|
|
30
31
|
```typescript
|
|
@@ -41,10 +42,6 @@ native.launcher(new Boot());
|
|
|
41
42
|
|
|
42
43
|
Clone and `npm run native`.
|
|
43
44
|
|
|
44
|
-
## Changelog
|
|
45
|
-
|
|
46
|
-
[Changelog](doc/CHANGELOG.md)
|
|
47
|
-
|
|
48
45
|
## License
|
|
49
46
|
|
|
50
47
|
This library is published under [Apache-2.0](./LICENSE) license.
|
package/dist/index.d.ts
CHANGED
|
@@ -1,22 +1,68 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const fs: typeof libFs;
|
|
3
|
-
import * as libTool from './lib/tool';
|
|
4
|
-
export declare const tool: typeof libTool;
|
|
1
|
+
/** --- 全局类 --- */
|
|
5
2
|
export declare abstract class AbstractBoot {
|
|
6
|
-
|
|
3
|
+
/**
|
|
4
|
+
* --- 是否含有实体窗体边框和标题 ---
|
|
5
|
+
*/
|
|
7
6
|
get hasFrame(): boolean;
|
|
7
|
+
/**
|
|
8
|
+
* --- 没有实体窗体时整个实体进程是不是会被结束 ---
|
|
9
|
+
*/
|
|
8
10
|
get isNoFormQuit(): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* --- 当前系统代号 ---
|
|
13
|
+
*/
|
|
9
14
|
get platform(): NodeJS.Platform;
|
|
15
|
+
/**
|
|
16
|
+
* --- 当前的通讯 token ---
|
|
17
|
+
*/
|
|
10
18
|
get token(): string;
|
|
19
|
+
/** --- 入口方法 --- */
|
|
11
20
|
abstract main(): void | Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* --- 开始运行起来一个主实体窗体,整个进程本方法只能执行一次 ---
|
|
23
|
+
* @param path 实体窗体网页路径
|
|
24
|
+
* @param opt 参数
|
|
25
|
+
*/
|
|
12
26
|
run(path: string, opt?: {
|
|
27
|
+
/** --- 是否显示实体窗体边框和标题,默认 true --- */
|
|
13
28
|
'frame'?: boolean;
|
|
29
|
+
/** --- 没有实体窗体时整个实体进程是不是会被结束,默认 true --- */
|
|
14
30
|
'quit'?: boolean;
|
|
31
|
+
/** --- 是否是开发模式,默认 false --- */
|
|
15
32
|
'dev'?: boolean;
|
|
33
|
+
/** --- 自定义宽度 --- */
|
|
34
|
+
'width'?: number;
|
|
35
|
+
/** --- 自定义高度 --- */
|
|
36
|
+
'height'?: number;
|
|
37
|
+
/** --- 是否有最大化按钮,默认 true --- */
|
|
38
|
+
'max'?: boolean;
|
|
39
|
+
/** --- 最大化状态,默认 false --- */
|
|
40
|
+
'stateMax'?: boolean;
|
|
41
|
+
/** --- 应用启动后、网页加载成功前显示的底色 --- */
|
|
42
|
+
'background'?: string;
|
|
16
43
|
}): void;
|
|
44
|
+
/**
|
|
45
|
+
* --- 绑定监听网页调用方法的方法 ---
|
|
46
|
+
* @param name 方法名
|
|
47
|
+
* @param handler 要执行的函数
|
|
48
|
+
* @param once 是否只执行一次
|
|
49
|
+
*/
|
|
17
50
|
on(name: string, handler: (...param: any[]) => any | Promise<any>, once?: boolean): void;
|
|
51
|
+
/**
|
|
52
|
+
* --- 绑定监听网页调用方法的方法但只会执行一次 ---
|
|
53
|
+
* @param name 方法名
|
|
54
|
+
* @param handler 要执行的函数
|
|
55
|
+
*/
|
|
18
56
|
once(name: string, handler: (...param: any[]) => any | Promise<any>): void;
|
|
57
|
+
/**
|
|
58
|
+
* --- 解绑监听的方法 ---
|
|
59
|
+
* @param name 方法名
|
|
60
|
+
*/
|
|
19
61
|
off(name: string): void;
|
|
62
|
+
/**
|
|
63
|
+
* --- 显示一个 dialog ---
|
|
64
|
+
* @param opt 选项或者一段文字
|
|
65
|
+
*/
|
|
20
66
|
dialog(options?: string | {
|
|
21
67
|
'type'?: 'info' | 'error' | 'question' | 'warning';
|
|
22
68
|
'title'?: string;
|
|
@@ -25,5 +71,30 @@ export declare abstract class AbstractBoot {
|
|
|
25
71
|
'buttons'?: string[];
|
|
26
72
|
}): number;
|
|
27
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* --- 加载本地路径需要使用本函数加载 ---
|
|
76
|
+
* @param importUrl 传入 import.meta.url
|
|
77
|
+
* @param p 要加载的相对路径,如 ./index.html
|
|
78
|
+
*/
|
|
79
|
+
export declare function path(importUrl: string, p: string): string;
|
|
80
|
+
export declare function showMainForm(path: string, opt?: {
|
|
81
|
+
/** --- 是否是开发模式,默认 false --- */
|
|
82
|
+
'dev'?: boolean;
|
|
83
|
+
/** --- 自定义宽度 --- */
|
|
84
|
+
'width'?: number;
|
|
85
|
+
/** --- 自定义高度 --- */
|
|
86
|
+
'height'?: number;
|
|
87
|
+
/** --- 是否有最大化按钮,默认 true --- */
|
|
88
|
+
'max'?: boolean;
|
|
89
|
+
/** --- 最大化状态,默认 false --- */
|
|
90
|
+
'stateMax'?: boolean;
|
|
91
|
+
/** --- 应用启动后、网页加载成功前显示的底色 --- */
|
|
92
|
+
'background'?: string;
|
|
93
|
+
}): void;
|
|
94
|
+
/** --- 用户调用运行 boot 类 --- */
|
|
28
95
|
export declare function launcher(boot: AbstractBoot): void;
|
|
96
|
+
/**
|
|
97
|
+
* --- 验证 token 是否正确 ---
|
|
98
|
+
* @param t 要验证的 token
|
|
99
|
+
*/
|
|
29
100
|
export declare function verifyToken(t: string): boolean;
|