clickgo-native 1.0.0 → 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/dist/index.d.ts +6 -0
- package/dist/index.js +12 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -71,6 +71,12 @@ export declare abstract class AbstractBoot {
|
|
|
71
71
|
'buttons'?: string[];
|
|
72
72
|
}): number;
|
|
73
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;
|
|
74
80
|
export declare function showMainForm(path: string, opt?: {
|
|
75
81
|
/** --- 是否是开发模式,默认 false --- */
|
|
76
82
|
'dev'?: boolean;
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as electron from 'electron';
|
|
2
|
+
import * as nodePath from 'path';
|
|
2
3
|
import * as lFs from './lib/fs.js';
|
|
3
4
|
import * as lTool from './lib/tool.js';
|
|
4
5
|
// npm publish --tag dev --access public
|
|
@@ -456,6 +457,17 @@ export class AbstractBoot {
|
|
|
456
457
|
});
|
|
457
458
|
}
|
|
458
459
|
}
|
|
460
|
+
/**
|
|
461
|
+
* --- 加载本地路径需要使用本函数加载 ---
|
|
462
|
+
* @param importUrl 传入 import.meta.url
|
|
463
|
+
* @param p 要加载的相对路径,如 ./index.html
|
|
464
|
+
*/
|
|
465
|
+
export function path(importUrl, p) {
|
|
466
|
+
let url = importUrl.replace('file:///', '');
|
|
467
|
+
const lio = url.lastIndexOf('/');
|
|
468
|
+
url = url.slice(0, lio + 1);
|
|
469
|
+
return nodePath.join(url, p);
|
|
470
|
+
}
|
|
459
471
|
export function showMainForm(path, opt = {}) {
|
|
460
472
|
if (form) {
|
|
461
473
|
// --- 有主窗体了就不能创建了 ---
|