@lynker-desktop/electron-window-manager 0.0.9-alpha.2 → 0.0.9-alpha.20
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/common/index.d.ts +17 -0
- package/common/index.d.ts.map +1 -1
- package/esm/common/index.d.ts +17 -0
- package/esm/common/index.d.ts.map +1 -1
- package/esm/main/index.d.ts +34 -8
- package/esm/main/index.d.ts.map +1 -1
- package/esm/main/index.js +402 -96
- package/esm/main/index.js.map +1 -1
- package/esm/renderer/index.d.ts +4 -4
- package/esm/renderer/index.d.ts.map +1 -1
- package/esm/renderer/index.js +6 -6
- package/esm/renderer/index.js.map +1 -1
- package/main/index.d.ts +34 -8
- package/main/index.d.ts.map +1 -1
- package/main/index.js +402 -96
- package/main/index.js.map +1 -1
- package/package.json +2 -2
- package/renderer/index.d.ts +4 -4
- package/renderer/index.d.ts.map +1 -1
- package/renderer/index.js +6 -6
- package/renderer/index.js.map +1 -1
package/main/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { WebContents } from 'electron';
|
|
2
|
-
import type { ElectronWindowsManagerOptions, BWItem, BVItem } from '../common';
|
|
2
|
+
import type { ElectronWindowsManagerOptions, BWItem, BVItem, PreloadWebContentsConfig } from '../common';
|
|
3
3
|
export declare const getCustomSession: () => Electron.Session;
|
|
4
4
|
export declare const enable: (win: WebContents) => void;
|
|
5
5
|
export declare class WindowsManager {
|
|
6
6
|
loadingViewUrl: string | undefined;
|
|
7
7
|
errorViewUrl: string | undefined;
|
|
8
8
|
preload?: string;
|
|
9
|
-
|
|
9
|
+
preloadWebContentsConfig?: PreloadWebContentsConfig;
|
|
10
10
|
windows: Map<number, BWItem | BVItem>;
|
|
11
11
|
preloadedBW: BWItem | null;
|
|
12
12
|
preloadedBW_FramelessWithButtons: BWItem | null;
|
|
@@ -14,6 +14,8 @@ export declare class WindowsManager {
|
|
|
14
14
|
preloadedBV: BVItem | null;
|
|
15
15
|
preloading: boolean;
|
|
16
16
|
webviewDomainWhiteList: string[];
|
|
17
|
+
private createQueue;
|
|
18
|
+
private isCreating;
|
|
17
19
|
/**
|
|
18
20
|
* webview 域名白名单
|
|
19
21
|
* 传入格式示例:
|
|
@@ -30,18 +32,42 @@ export declare class WindowsManager {
|
|
|
30
32
|
* - 不带点的(如 example.com)只匹配主域名。
|
|
31
33
|
* - 'localhost'、'127.0.0.1'、'::1' 以及局域网 IP(如 192.168.x.x、10.x.x.x、172.16.x.x~172.31.x.x)都视为本地白名单。
|
|
32
34
|
*/
|
|
33
|
-
constructor(preload?: string, loadingViewUrl?: string, errorViewUrl?: string,
|
|
34
|
-
|
|
35
|
+
constructor(preload?: string, loadingViewUrl?: string, errorViewUrl?: string, preloadWebContentsConfig?: PreloadWebContentsConfig, webviewDomainWhiteList?: string[]);
|
|
36
|
+
/**
|
|
37
|
+
* 设置预加载的webContents配置
|
|
38
|
+
* @param preloadWebContentsConfig 预加载的webContents配置
|
|
39
|
+
*/
|
|
40
|
+
setPreloadWebContentsConfig(preloadWebContentsConfig: PreloadWebContentsConfig): void;
|
|
41
|
+
/**
|
|
42
|
+
* 预加载实例
|
|
43
|
+
*/
|
|
35
44
|
private _preloadInstances;
|
|
45
|
+
/**
|
|
46
|
+
* 创建预加载的窗口
|
|
47
|
+
* @param options 窗口选项
|
|
48
|
+
* @returns 预加载的窗口
|
|
49
|
+
*/
|
|
36
50
|
private _createPreloadBW;
|
|
51
|
+
/**
|
|
52
|
+
* 创建预加载的浏览器视图
|
|
53
|
+
* @returns 预加载的浏览器视图
|
|
54
|
+
*/
|
|
37
55
|
private _createPreloadBV;
|
|
38
56
|
create(options: Omit<ElectronWindowsManagerOptions, 'type'> & {
|
|
39
57
|
type?: 'BW';
|
|
40
|
-
}): BWItem
|
|
58
|
+
}): Promise<BWItem>;
|
|
41
59
|
create(options: ElectronWindowsManagerOptions & {
|
|
42
60
|
type: 'BV';
|
|
43
|
-
}): BVItem
|
|
44
|
-
create(options: ElectronWindowsManagerOptions):
|
|
61
|
+
}): Promise<BVItem>;
|
|
62
|
+
create(options: ElectronWindowsManagerOptions): Promise<BVItem | BWItem>;
|
|
63
|
+
/**
|
|
64
|
+
* 处理创建队列
|
|
65
|
+
*/
|
|
66
|
+
private processCreateQueue;
|
|
67
|
+
/**
|
|
68
|
+
* 实际的窗口创建逻辑
|
|
69
|
+
*/
|
|
70
|
+
private _createWindow;
|
|
45
71
|
_setLoadingView(window: BWItem, createOptions: ElectronWindowsManagerOptions): void;
|
|
46
72
|
get(idOrName: string | number): BWItem | BVItem | undefined;
|
|
47
73
|
getAll(type: 'BW'): Map<number, BWItem>;
|
|
@@ -57,5 +83,5 @@ export declare class WindowsManager {
|
|
|
57
83
|
createPreloadWebContents(url: string): Promise<unknown>;
|
|
58
84
|
}
|
|
59
85
|
export declare let isInitialized: boolean;
|
|
60
|
-
export declare const initialize: (preload?: string, loadingViewUrl?: string, errorViewUrl?: string,
|
|
86
|
+
export declare const initialize: (preload?: string, loadingViewUrl?: string, errorViewUrl?: string, preloadWebContentsConfig?: PreloadWebContentsConfig, webviewDomainWhiteList?: string[]) => WindowsManager;
|
|
61
87
|
//# sourceMappingURL=index.d.ts.map
|
package/main/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/main/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAmC,WAAW,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/main/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAmC,WAAW,EAAiG,MAAM,UAAU,CAAA;AAItK,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,EAAE,MAAM,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AAEzG,eAAO,MAAM,gBAAgB,wBAQzB,CAAC;AAUL,eAAO,MAAM,MAAM,QAAS,WAAW,SAEtC,CAAA;AAoBD,qBAAa,cAAc;IACzB,cAAc,E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