clickgo-native 0.0.2-dev2 → 0.0.3-dev3
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 +9 -28
- package/dist/index.js +303 -93
- package/dist/index.ts +360 -126
- package/dist/lib/fs.js +324 -0
- package/dist/lib/fs.ts +284 -0
- package/dist/lib/tool.js +11 -0
- package/dist/lib/tool.ts +11 -0
- package/dist/pre.js +24 -1
- package/dist/pre.ts +1 -1
- package/package.json +8 -9
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
[](https://www.npmjs.com/package/clickgo-native "Stable Version")
|
|
6
6
|
[](https://www.npmjs.com/package/clickgo-native "Development Version")
|
|
7
7
|
[](https://www.npmjs.com/package/clickgo-native "Beta Version")
|
|
8
|
-
[](https://github.com/maiyun/clickgo-native/blob/master/LICENSE)
|
|
9
9
|
[](https://github.com/maiyun/clickgo-native/issues)
|
|
10
10
|
[](https://github.com/maiyun/clickgo-native/releases "Stable Release")
|
|
11
11
|
[](https://github.com/maiyun/clickgo-native/releases "Pre-Release")
|
|
@@ -17,46 +17,27 @@ The software developed with ClickGo will run in Windows, Mac OS, Linux.
|
|
|
17
17
|
You can install directly using NPM:
|
|
18
18
|
|
|
19
19
|
```sh
|
|
20
|
-
$ npm i clickgo --save
|
|
20
|
+
$ npm i clickgo-native --save
|
|
21
21
|
```
|
|
22
22
|
|
|
23
23
|
Or install the developing (unstable) version for newest features:
|
|
24
24
|
|
|
25
25
|
```sh
|
|
26
|
-
$ npm i clickgo@dev --save
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
**index.html**
|
|
30
|
-
|
|
31
|
-
```html
|
|
32
|
-
<script src="https://cdn.jsdelivr.net/npm/@litert/loader@3.2.0/dist/loader.min.js?path=index"></script>
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
**index.js**
|
|
36
|
-
|
|
37
|
-
```typescript
|
|
38
|
-
import * as clickgo from 'clickgo';
|
|
39
|
-
async function run(): Promise<void> {
|
|
40
|
-
await clickgo.init();
|
|
41
|
-
await clickgo.task.run('app/');
|
|
42
|
-
}
|
|
26
|
+
$ npm i clickgo-native@dev --save
|
|
43
27
|
```
|
|
44
28
|
|
|
45
29
|
**Node**
|
|
46
30
|
|
|
47
31
|
```typescript
|
|
48
32
|
import * as native from 'clickgo-native';
|
|
49
|
-
native.
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
33
|
+
class Boot extends native.AbstractBoot {
|
|
34
|
+
public main(): void {
|
|
35
|
+
this.run('./index.html');
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
native.launcher(new Boot());
|
|
54
39
|
```
|
|
55
40
|
|
|
56
|
-
## Note
|
|
57
|
-
|
|
58
|
-
ClickGo demand loading Vue, jszip, resize-observer, but **DO NOT** reference these JS and CSS files. ClickGo will automatically reference. You only need to import "clickgo" module.
|
|
59
|
-
|
|
60
41
|
## Demo
|
|
61
42
|
|
|
62
43
|
Clone and `npm run native`.
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
2
25
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
26
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
27
|
return new (P || (P = Promise))(function (resolve, reject) {
|
|
@@ -9,31 +32,34 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
32
|
});
|
|
10
33
|
};
|
|
11
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.
|
|
13
|
-
const electron = require("electron");
|
|
14
|
-
const path = require("path");
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
let
|
|
20
|
-
|
|
35
|
+
exports.verifyToken = exports.launcher = exports.AbstractBoot = exports.tool = exports.fs = void 0;
|
|
36
|
+
const electron = __importStar(require("electron"));
|
|
37
|
+
const path = __importStar(require("path"));
|
|
38
|
+
const libFs = __importStar(require("./lib/fs"));
|
|
39
|
+
exports.fs = libFs;
|
|
40
|
+
const libTool = __importStar(require("./lib/tool"));
|
|
41
|
+
exports.tool = libTool;
|
|
42
|
+
let isImmersion = false;
|
|
43
|
+
let hasFrame = false;
|
|
44
|
+
let isNoFormQuit = true;
|
|
45
|
+
let form;
|
|
21
46
|
let token = '';
|
|
47
|
+
const platform = process.platform;
|
|
22
48
|
const methods = {
|
|
23
49
|
'cg-init': {
|
|
24
50
|
'once': true,
|
|
25
51
|
handler: function (t) {
|
|
26
|
-
if (!t || !
|
|
52
|
+
if (!t || !form) {
|
|
27
53
|
return;
|
|
28
54
|
}
|
|
29
|
-
|
|
55
|
+
form.resizable = true;
|
|
30
56
|
token = t;
|
|
31
57
|
}
|
|
32
58
|
},
|
|
33
59
|
'cg-quit': {
|
|
34
60
|
'once': false,
|
|
35
61
|
handler: function (t) {
|
|
36
|
-
if (!
|
|
62
|
+
if (!t || !form) {
|
|
37
63
|
return;
|
|
38
64
|
}
|
|
39
65
|
if (!verifyToken(t)) {
|
|
@@ -45,20 +71,20 @@ const methods = {
|
|
|
45
71
|
'cg-set-size': {
|
|
46
72
|
'once': false,
|
|
47
73
|
handler: function (t, width, height) {
|
|
48
|
-
if (!
|
|
74
|
+
if (isImmersion || !form || !width || !height) {
|
|
49
75
|
return;
|
|
50
76
|
}
|
|
51
77
|
if (!verifyToken(t)) {
|
|
52
78
|
return;
|
|
53
79
|
}
|
|
54
|
-
|
|
55
|
-
|
|
80
|
+
form.setSize(width, height);
|
|
81
|
+
form.center();
|
|
56
82
|
}
|
|
57
83
|
},
|
|
58
84
|
'cg-set-state': {
|
|
59
85
|
'once': false,
|
|
60
86
|
handler: function (t, state) {
|
|
61
|
-
if (!
|
|
87
|
+
if (hasFrame || !form || !state) {
|
|
62
88
|
return;
|
|
63
89
|
}
|
|
64
90
|
if (!verifyToken(t)) {
|
|
@@ -66,15 +92,15 @@ const methods = {
|
|
|
66
92
|
}
|
|
67
93
|
switch (state) {
|
|
68
94
|
case 'max': {
|
|
69
|
-
|
|
95
|
+
form.maximize();
|
|
70
96
|
break;
|
|
71
97
|
}
|
|
72
98
|
case 'min': {
|
|
73
|
-
|
|
99
|
+
form.minimize();
|
|
74
100
|
break;
|
|
75
101
|
}
|
|
76
102
|
default: {
|
|
77
|
-
|
|
103
|
+
form.restore();
|
|
78
104
|
}
|
|
79
105
|
}
|
|
80
106
|
}
|
|
@@ -82,51 +108,270 @@ const methods = {
|
|
|
82
108
|
'cg-close': {
|
|
83
109
|
'once': false,
|
|
84
110
|
handler: function (t) {
|
|
85
|
-
if (!
|
|
111
|
+
if (!form) {
|
|
86
112
|
return;
|
|
87
113
|
}
|
|
88
114
|
if (!verifyToken(t)) {
|
|
89
115
|
return;
|
|
90
116
|
}
|
|
91
|
-
|
|
117
|
+
form.close();
|
|
92
118
|
}
|
|
93
119
|
},
|
|
94
120
|
'cg-mouse-ignore': {
|
|
95
121
|
'once': false,
|
|
96
122
|
handler: function (t, val) {
|
|
97
|
-
if (!
|
|
123
|
+
if (!isImmersion || !form) {
|
|
98
124
|
return;
|
|
99
125
|
}
|
|
100
126
|
if (!verifyToken(t)) {
|
|
101
127
|
return;
|
|
102
128
|
}
|
|
103
129
|
if (val) {
|
|
104
|
-
|
|
130
|
+
form.setIgnoreMouseEvents(true, { 'forward': true });
|
|
105
131
|
}
|
|
106
132
|
else {
|
|
107
|
-
|
|
133
|
+
form.setIgnoreMouseEvents(false);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
},
|
|
137
|
+
'cg-maximizable': {
|
|
138
|
+
'once': false,
|
|
139
|
+
handler: function (t, val) {
|
|
140
|
+
if (isImmersion || !form) {
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
143
|
+
if (!verifyToken(t)) {
|
|
144
|
+
return;
|
|
108
145
|
}
|
|
146
|
+
form.setMaximizable(val);
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
'cg-fs-getContent': {
|
|
150
|
+
'once': false,
|
|
151
|
+
handler: function (t, path, options) {
|
|
152
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
153
|
+
if (!verifyToken(t)) {
|
|
154
|
+
return null;
|
|
155
|
+
}
|
|
156
|
+
return libFs.getContent(path, options);
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
'cg-fs-putContent': {
|
|
161
|
+
'once': false,
|
|
162
|
+
handler: function (t, path, data, options) {
|
|
163
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
164
|
+
if (!verifyToken(t)) {
|
|
165
|
+
return false;
|
|
166
|
+
}
|
|
167
|
+
return exports.fs.putContent(path, data, options);
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
},
|
|
171
|
+
'cg-fs-readLink': {
|
|
172
|
+
'once': false,
|
|
173
|
+
handler: function (t, path, encoding) {
|
|
174
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
175
|
+
if (!verifyToken(t)) {
|
|
176
|
+
return null;
|
|
177
|
+
}
|
|
178
|
+
return exports.fs.readLink(path, encoding);
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
'cg-fs-symlink': {
|
|
183
|
+
'once': false,
|
|
184
|
+
handler: function (t, filePath, linkPath, type) {
|
|
185
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
186
|
+
if (!verifyToken(t)) {
|
|
187
|
+
return false;
|
|
188
|
+
}
|
|
189
|
+
return exports.fs.symlink(filePath, linkPath, type);
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
'cg-fs-unlink': {
|
|
194
|
+
'once': false,
|
|
195
|
+
handler: function (t, path) {
|
|
196
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
197
|
+
if (!verifyToken(t)) {
|
|
198
|
+
return false;
|
|
199
|
+
}
|
|
200
|
+
return exports.fs.unlink(path);
|
|
201
|
+
});
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
'cg-fs-stats': {
|
|
205
|
+
'once': false,
|
|
206
|
+
handler: function (t, path) {
|
|
207
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
208
|
+
if (!verifyToken(t)) {
|
|
209
|
+
return null;
|
|
210
|
+
}
|
|
211
|
+
return exports.fs.stats(path);
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
'cg-fs-mkdir': {
|
|
216
|
+
'once': false,
|
|
217
|
+
handler: function (t, path, mode) {
|
|
218
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
219
|
+
if (!verifyToken(t)) {
|
|
220
|
+
return false;
|
|
221
|
+
}
|
|
222
|
+
return exports.fs.mkdir(path, mode);
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
},
|
|
226
|
+
'cg-fs-rmdir': {
|
|
227
|
+
'once': false,
|
|
228
|
+
handler: function (t, path) {
|
|
229
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
230
|
+
if (!verifyToken(t)) {
|
|
231
|
+
return false;
|
|
232
|
+
}
|
|
233
|
+
return exports.fs.rmdir(path);
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
'cg-fs-chmod': {
|
|
238
|
+
'once': false,
|
|
239
|
+
handler: function (t, path, mod) {
|
|
240
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
241
|
+
if (!verifyToken(t)) {
|
|
242
|
+
return false;
|
|
243
|
+
}
|
|
244
|
+
return exports.fs.chmod(path, mod);
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
},
|
|
248
|
+
'cg-fs-rename': {
|
|
249
|
+
'once': false,
|
|
250
|
+
handler: function (t, oldPath, newPath) {
|
|
251
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
252
|
+
if (!verifyToken(t)) {
|
|
253
|
+
return false;
|
|
254
|
+
}
|
|
255
|
+
return exports.fs.rename(oldPath, newPath);
|
|
256
|
+
});
|
|
257
|
+
}
|
|
258
|
+
},
|
|
259
|
+
'cg-fs-readDir': {
|
|
260
|
+
'once': false,
|
|
261
|
+
handler: function (t, path, encoding) {
|
|
262
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
263
|
+
if (!verifyToken(t)) {
|
|
264
|
+
return [];
|
|
265
|
+
}
|
|
266
|
+
return exports.fs.readDir(path, encoding);
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
},
|
|
270
|
+
'cg-fs-copyFile': {
|
|
271
|
+
'once': false,
|
|
272
|
+
handler: function (t, src, dest) {
|
|
273
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
274
|
+
if (!verifyToken(t)) {
|
|
275
|
+
return false;
|
|
276
|
+
}
|
|
277
|
+
return exports.fs.copyFile(src, dest);
|
|
278
|
+
});
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
'cg-ping': {
|
|
282
|
+
'once': false,
|
|
283
|
+
handler: function (t) {
|
|
284
|
+
return 'pong: ' + t;
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
'cg-is-max': {
|
|
288
|
+
'once': false,
|
|
289
|
+
handler: function () {
|
|
290
|
+
return (form === null || form === void 0 ? void 0 : form.isMaximized) ? true : false;
|
|
109
291
|
}
|
|
110
292
|
}
|
|
111
293
|
};
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
294
|
+
class AbstractBoot {
|
|
295
|
+
get isImmersion() {
|
|
296
|
+
return isImmersion;
|
|
297
|
+
}
|
|
298
|
+
get hasFrame() {
|
|
299
|
+
return hasFrame;
|
|
300
|
+
}
|
|
301
|
+
get isNoFormQuit() {
|
|
302
|
+
return isNoFormQuit;
|
|
303
|
+
}
|
|
304
|
+
get platform() {
|
|
305
|
+
return platform;
|
|
306
|
+
}
|
|
307
|
+
get token() {
|
|
308
|
+
return token;
|
|
309
|
+
}
|
|
310
|
+
run(path, opt = {}) {
|
|
311
|
+
if (opt.frame !== undefined) {
|
|
312
|
+
hasFrame = opt.frame;
|
|
313
|
+
}
|
|
314
|
+
if (opt.quit !== undefined) {
|
|
315
|
+
isNoFormQuit = opt.quit;
|
|
316
|
+
}
|
|
317
|
+
if (platform === 'win32') {
|
|
318
|
+
if (!hasFrame) {
|
|
319
|
+
isImmersion = true;
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
createForm(path);
|
|
323
|
+
electron.app.on('window-all-closed', function () {
|
|
324
|
+
if (isNoFormQuit) {
|
|
325
|
+
electron.app.quit();
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
electron.app.on('activate', function () {
|
|
329
|
+
if (electron.BrowserWindow.getAllWindows().length > 0) {
|
|
330
|
+
return;
|
|
331
|
+
}
|
|
332
|
+
createForm(path);
|
|
333
|
+
methods['cg-init'] = {
|
|
334
|
+
'once': true,
|
|
335
|
+
handler: function (t) {
|
|
336
|
+
if (!t || !form) {
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
form.resizable = true;
|
|
340
|
+
token = t;
|
|
341
|
+
}
|
|
342
|
+
};
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
on(name, handler, once = false) {
|
|
346
|
+
methods[name] = {
|
|
347
|
+
'once': once,
|
|
348
|
+
'handler': handler
|
|
349
|
+
};
|
|
350
|
+
}
|
|
351
|
+
once(name, handler) {
|
|
352
|
+
this.on(name, handler, true);
|
|
353
|
+
}
|
|
354
|
+
off(name) {
|
|
355
|
+
if (!methods[name]) {
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
delete methods[name];
|
|
359
|
+
}
|
|
121
360
|
}
|
|
122
|
-
exports.
|
|
123
|
-
function
|
|
124
|
-
|
|
361
|
+
exports.AbstractBoot = AbstractBoot;
|
|
362
|
+
function launcher(boot) {
|
|
363
|
+
(function () {
|
|
364
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
365
|
+
yield electron.app.whenReady();
|
|
366
|
+
yield exports.fs.refreshDrives();
|
|
367
|
+
yield boot.main();
|
|
368
|
+
});
|
|
369
|
+
})().catch(function () {
|
|
125
370
|
return;
|
|
126
|
-
}
|
|
127
|
-
delete methods[name];
|
|
371
|
+
});
|
|
128
372
|
}
|
|
129
|
-
exports.
|
|
373
|
+
exports.launcher = launcher;
|
|
374
|
+
electron.Menu.setApplicationMenu(null);
|
|
130
375
|
electron.ipcMain.handle('pre', function (e, name, ...param) {
|
|
131
376
|
if (!methods[name]) {
|
|
132
377
|
return;
|
|
@@ -144,13 +389,6 @@ function verifyToken(t) {
|
|
|
144
389
|
return true;
|
|
145
390
|
}
|
|
146
391
|
exports.verifyToken = verifyToken;
|
|
147
|
-
function ready() {
|
|
148
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
149
|
-
yield electron.app.whenReady();
|
|
150
|
-
isReady = true;
|
|
151
|
-
});
|
|
152
|
-
}
|
|
153
|
-
exports.ready = ready;
|
|
154
392
|
function createForm(p) {
|
|
155
393
|
const op = {
|
|
156
394
|
'webPreferences': {
|
|
@@ -158,73 +396,45 @@ function createForm(p) {
|
|
|
158
396
|
'contextIsolation': true,
|
|
159
397
|
'preload': path.join(__dirname, '/pre.js')
|
|
160
398
|
},
|
|
161
|
-
'width': 500,
|
|
162
|
-
'height':
|
|
163
|
-
'frame':
|
|
399
|
+
'width': hasFrame ? 800 : 500,
|
|
400
|
+
'height': hasFrame ? 600 : 300,
|
|
401
|
+
'frame': hasFrame,
|
|
164
402
|
'resizable': false,
|
|
165
403
|
'show': false,
|
|
166
404
|
'center': true,
|
|
167
|
-
'transparent':
|
|
405
|
+
'transparent': isImmersion ? true : false
|
|
168
406
|
};
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
if (!
|
|
407
|
+
form = new electron.BrowserWindow(op);
|
|
408
|
+
form.webContents.userAgent = 'electron/' + electron.app.getVersion() + ' ' + platform + '/' + process.arch + ' immersion/' + (isImmersion ? '1' : '0') + ' frame/' + (hasFrame ? '1' : '0');
|
|
409
|
+
form.once('ready-to-show', function () {
|
|
410
|
+
if (!form) {
|
|
173
411
|
return;
|
|
174
412
|
}
|
|
175
|
-
if (
|
|
176
|
-
|
|
177
|
-
|
|
413
|
+
if (isImmersion) {
|
|
414
|
+
form.maximize();
|
|
415
|
+
form.setIgnoreMouseEvents(true, { 'forward': true });
|
|
178
416
|
}
|
|
179
417
|
else {
|
|
180
418
|
}
|
|
181
|
-
|
|
419
|
+
form.show();
|
|
182
420
|
});
|
|
183
421
|
const lio = p.indexOf('?');
|
|
184
422
|
const search = lio === -1 ? '' : p.slice(lio + 1);
|
|
185
423
|
if (lio !== -1) {
|
|
186
424
|
p = p.slice(0, lio);
|
|
187
425
|
}
|
|
188
|
-
|
|
426
|
+
form.loadFile(p, {
|
|
189
427
|
'search': search
|
|
190
428
|
}).catch(function (e) {
|
|
191
429
|
throw e;
|
|
192
430
|
});
|
|
193
|
-
|
|
194
|
-
|
|
431
|
+
form.on('close', function () {
|
|
432
|
+
form = undefined;
|
|
195
433
|
});
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
if (!isReady) {
|
|
199
|
-
return;
|
|
200
|
-
}
|
|
201
|
-
if (opt.frame !== undefined) {
|
|
202
|
-
isFrame = opt.frame;
|
|
203
|
-
}
|
|
204
|
-
if (opt.quit !== undefined) {
|
|
205
|
-
isQuit = opt.quit;
|
|
206
|
-
}
|
|
207
|
-
createForm(path);
|
|
208
|
-
electron.app.on('window-all-closed', function () {
|
|
209
|
-
if (isQuit) {
|
|
210
|
-
electron.app.quit();
|
|
211
|
-
}
|
|
434
|
+
form.on('maximize', function () {
|
|
435
|
+
form === null || form === void 0 ? void 0 : form.webContents.executeJavaScript('if(window.clickgoNativeWeb){clickgoNativeWeb.invoke("maximize")}');
|
|
212
436
|
});
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
return;
|
|
216
|
-
}
|
|
217
|
-
createForm(path);
|
|
218
|
-
methods['cg-init'] = {
|
|
219
|
-
'once': true,
|
|
220
|
-
handler: function (t) {
|
|
221
|
-
if (!t || !win) {
|
|
222
|
-
return;
|
|
223
|
-
}
|
|
224
|
-
win.resizable = true;
|
|
225
|
-
token = t;
|
|
226
|
-
}
|
|
227
|
-
};
|
|
437
|
+
form.on('unmaximize', function () {
|
|
438
|
+
form === null || form === void 0 ? void 0 : form.webContents.executeJavaScript('if(window.clickgoNativeWeb){clickgoNativeWeb.invoke("unmaximize")}');
|
|
228
439
|
});
|
|
229
440
|
}
|
|
230
|
-
exports.run = run;
|