clickgo-native 0.0.16 → 0.0.18
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 +0 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +23 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,7 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/clickgo-native "Stable Version")
|
|
6
6
|
[](https://www.npmjs.com/package/clickgo-native "Development Version")
|
|
7
|
-
[](https://www.npmjs.com/package/clickgo-native "Beta Version")
|
|
8
7
|
[](https://github.com/maiyun/clickgo-native/blob/master/LICENSE)
|
|
9
8
|
[](https://github.com/maiyun/clickgo-native/issues)
|
|
10
9
|
[](https://github.com/maiyun/clickgo-native/releases "Stable Release")
|
package/dist/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export declare abstract class AbstractBoot {
|
|
|
12
12
|
run(path: string, opt?: {
|
|
13
13
|
'frame'?: boolean;
|
|
14
14
|
'quit'?: boolean;
|
|
15
|
+
'dev'?: boolean;
|
|
15
16
|
}): void;
|
|
16
17
|
on(name: string, handler: (...param: any[]) => any | Promise<any>, once?: boolean): void;
|
|
17
18
|
once(name: string, handler: (...param: any[]) => any | Promise<any>): void;
|
package/dist/index.js
CHANGED
|
@@ -96,7 +96,7 @@ const methods = {
|
|
|
96
96
|
'cg-set-state': {
|
|
97
97
|
'once': false,
|
|
98
98
|
handler: function (t, state) {
|
|
99
|
-
if (!
|
|
99
|
+
if (!form || !state) {
|
|
100
100
|
return;
|
|
101
101
|
}
|
|
102
102
|
if (!verifyToken(t)) {
|
|
@@ -438,6 +438,9 @@ class AbstractBoot {
|
|
|
438
438
|
}
|
|
439
439
|
}
|
|
440
440
|
createForm(path);
|
|
441
|
+
if (form && opt.dev) {
|
|
442
|
+
form.webContents.openDevTools();
|
|
443
|
+
}
|
|
441
444
|
electron.app.on('window-all-closed', function () {
|
|
442
445
|
if (isNoFormQuit) {
|
|
443
446
|
electron.app.quit();
|
|
@@ -448,6 +451,9 @@ class AbstractBoot {
|
|
|
448
451
|
return;
|
|
449
452
|
}
|
|
450
453
|
createForm(path);
|
|
454
|
+
if (form && opt.dev) {
|
|
455
|
+
form.webContents.openDevTools();
|
|
456
|
+
}
|
|
451
457
|
methods['cg-init'] = {
|
|
452
458
|
'once': true,
|
|
453
459
|
handler: function (t) {
|
|
@@ -554,16 +560,23 @@ function createForm(p) {
|
|
|
554
560
|
}
|
|
555
561
|
form.show();
|
|
556
562
|
});
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
563
|
+
if (p.startsWith('https://') || p.startsWith('http://')) {
|
|
564
|
+
form.loadURL(p).catch(function (e) {
|
|
565
|
+
throw e;
|
|
566
|
+
});
|
|
567
|
+
}
|
|
568
|
+
else {
|
|
569
|
+
const lio = p.indexOf('?');
|
|
570
|
+
const search = lio === -1 ? '' : p.slice(lio + 1);
|
|
571
|
+
if (lio !== -1) {
|
|
572
|
+
p = p.slice(0, lio);
|
|
573
|
+
}
|
|
574
|
+
form.loadFile(p, {
|
|
575
|
+
'search': search
|
|
576
|
+
}).catch(function (e) {
|
|
577
|
+
throw e;
|
|
578
|
+
});
|
|
561
579
|
}
|
|
562
|
-
form.loadFile(p, {
|
|
563
|
-
'search': search
|
|
564
|
-
}).catch(function (e) {
|
|
565
|
-
throw e;
|
|
566
|
-
});
|
|
567
580
|
form.on('close', function () {
|
|
568
581
|
form = undefined;
|
|
569
582
|
});
|