nexfep 0.1.1 → 0.1.2

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.
Files changed (6) hide show
  1. package/LICENSE +20 -20
  2. package/README-CN.md +285 -285
  3. package/README.md +285 -285
  4. package/index.d.ts +45 -45
  5. package/index.js +121 -121
  6. package/package.json +35 -36
package/README.md CHANGED
@@ -1,285 +1,285 @@
1
- # Nexfep
2
-
3
- Language: English(now) | [简体中文](https://github.com/nexfteam/Nexfep/blob/main/README-CN.md)
4
-
5
- A desktop application framework based on @webviewjs/webview
6
-
7
- ## Project Status
8
-
9
- **🚧 Early Stage**
10
-
11
- This project is currently in early development, with many core capabilities for desktop application development still missing. The framework is being continuously iterated.
12
-
13
- ## Introduction
14
-
15
- Nexfep is a desktop application framework built on [@webviewjs/webview](https://github.com/webviewjs/webview), written in TypeScript. It aims to provide developers with a concise and efficient toolchain for building cross-platform desktop applications.
16
-
17
- The framework uses a window pool management mechanism, supporting multi-window application scenarios such as code editors, chat tools, dashboards, etc.
18
-
19
- ## Features
20
-
21
- - **Window Pool Management** — Built-in window pool mechanism for automatic reuse and recycling of window resources, avoiding the overhead of frequent creation and destruction
22
- - **IPC Communication** — Supports bidirectional message communication between the main process and WebView, via injected functions
23
- - **Window Control** — Provides complete window operation APIs including maximize, minimize, close, title setting, and developer tools
24
- - **Drag Regions** — Built-in HTML attribute support for defining window drag regions (`nexfep-area-drag`, etc.)
25
- - **TypeScript Support** — Complete type definitions for excellent development experience
26
-
27
- ## Installation
28
-
29
- ```bash
30
- pnpm add nexfep
31
- ```
32
-
33
- ## Quick Start
34
-
35
- ```typescript
36
- import { WindowPool } from 'nexfep';
37
-
38
- const pool = new WindowPool();
39
-
40
- const window = await pool.createWindow(true, false);
41
-
42
- await window.loadHTML('<h1 nexfep-area-drag>Hello Nexfep!</h1>');
43
-
44
- pool.mainloop();
45
- ```
46
-
47
- ## Usage Guide
48
-
49
- ### Window Pool
50
-
51
- `WindowPool` is the core management class of the framework, responsible for window creation and recycling.
52
-
53
- ```typescript
54
- const pool = new WindowPool();
55
- ```
56
-
57
- **Constructor Parameters**
58
-
59
- - `WindowsWebview2UserDataFolder` (optional) — WebView2 user data directory, defaults to `%LOCALAPPDATA%\NexfepDevelopment.webview2-data`
60
-
61
- ### Window Creation
62
-
63
- ```typescript
64
- const win = await pool.createWindow(true, false);
65
- ```
66
-
67
- **Parameters**
68
-
69
- - `isShow` (boolean, default `true`) — Whether to immediately show the window
70
- - `isDecorated` (boolean, default `true`) — Whether to use system window decorations. When set to `false`, the window has no border and requires a custom title bar
71
-
72
- ### Window Operations
73
-
74
- ```typescript
75
- window.show();
76
- window.hide();
77
- window.maximize();
78
- window.minimize();
79
- window.close();
80
- window.setTitle('New Title');
81
- window.openDevTools();
82
- ```
83
-
84
- ### IPC Communication
85
-
86
- The framework automatically injects a series of control functions after WebView page loading is complete. It is recommended to use these injected functions for IPC communication, rather than the native IPC wrapped by `@webviewjs/webview`.
87
-
88
- #### Send Custom Messages
89
-
90
- Send messages via `window.postMessage` in the page:
91
-
92
- ```javascript
93
- window.postMessage({ hello: 'world' });
94
- ```
95
-
96
- **Parameters**
97
-
98
- - `data` — Any serializable data, will be serialized to JSON string before sending
99
-
100
- #### Listen for Messages
101
-
102
- Receive messages via `onCustomMessage` callback in the main process:
103
-
104
- ```typescript
105
- pool.onCustomMessage = (window, data) => {
106
- console.log(`Message from window ${window.id}:`, data);
107
- };
108
- ```
109
-
110
- **Callback Parameters**
111
-
112
- - `window` — The window object that sent the message
113
- - `data` — Message content, an object type (automatically converted from JSON string via `JSON.parse`)
114
-
115
- #### Invoke Custom Events
116
-
117
- Invoke events via `window.invoke` in the page:
118
-
119
- ```javascript
120
- window.invoke('hello', 'world');
121
- ```
122
-
123
- **Parameters**
124
-
125
- - `event` — Event name
126
- - `data` — Any serializable data, will be serialized to JSON string before sending
127
-
128
- #### Listen for Events
129
-
130
- Listen for events via `pool.handle` in the main process:
131
-
132
- ```typescript
133
- pool.handle('hello', (data) => {
134
- console.log('Received event hello:', data);
135
- });
136
- ```
137
-
138
- **Parameters**
139
-
140
- - `event` — Event name, must match the event name when invoking
141
- - `callback` — Event handler function, receives event data as `data` parameter. Can return any serializable data, which will be serialized to JSON string and sent back to the frontend as the return value of `window.invoke` (can also return nothing)
142
-
143
- #### Remove Event Listener
144
-
145
- Remove event listener via `pool.unhandle` in the main process:
146
-
147
- ```typescript
148
- pool.unhandle('hello', (data) => {
149
- console.log('Received event hello:', data);
150
- });
151
- ```
152
-
153
- **Parameters**
154
-
155
- - `event` — Event name, must match the event name when listening
156
- - `callback` — Event handler function, must match the callback function when listening
157
-
158
- #### Window Control Functions
159
-
160
- The following injected functions can be directly called in the page for window control:
161
-
162
- ```javascript
163
- window.close(); // Close window
164
- window.minimize(); // Minimize window
165
- window.unminimize(); // Restore minimized window
166
- window.maximize(); // Maximize window
167
- window.unmaximize(); // Restore maximized window
168
- window.setTitle('Title'); // Set window title
169
- window.openDevTools(); // Open developer tools
170
- window.closeDevTools(); // Close developer tools
171
- ```
172
-
173
- ### Drag Regions
174
-
175
- Define window drag regions via HTML attributes without writing additional JavaScript code. These attributes automatically apply `-webkit-app-region` and `app-region` CSS properties.
176
-
177
- #### `nexfep-area-drag`
178
-
179
- Makes the entire region and all its child elements draggable. Suitable for scenarios like custom title bars where the entire region needs to be draggable.
180
-
181
- ```html
182
- <div nexfep-area-drag>
183
- <h1>Title Bar</h1>
184
- <span>Subtitle</span>
185
- </div>
186
- ```
187
-
188
- #### `nexfep-element-drag`
189
-
190
- Makes only the specified element itself draggable; child elements are not affected. Suitable for scenarios requiring precise control over the drag region.
191
-
192
- ```html
193
- <div>
194
- <div nexfep-element-drag>Drag Handle</div>
195
- <p>This part is not draggable</p>
196
- </div>
197
- ```
198
-
199
- #### `nexfep-no-drag`
200
-
201
- Makes the specified region and all its child elements non-draggable. Highest priority, can override parent element's drag attributes. Suitable for interactive elements like buttons and input fields.
202
-
203
- ```html
204
- <div nexfep-area-drag>
205
- <h1>Title Bar</h1>
206
- <button nexfep-no-drag>Click Button</button>
207
- </div>
208
- ```
209
-
210
- #### `nexfep-auto-drag`
211
-
212
- Automatically determines drag regions: the entire region is draggable, but common interactive elements (`button`, `input`, `select`, `textarea`, `a`) are automatically set to non-draggable. Suitable for complex regions containing multiple interactive elements.
213
-
214
- ```html
215
- <div nexfep-auto-drag>
216
- <h1>Title Bar</h1>
217
- <button>Automatically non-draggable</button>
218
- <input placeholder="Automatically non-draggable" />
219
- <a href="#">Automatically non-draggable</a>
220
- </div>
221
- ```
222
-
223
- ### Load Complete Event
224
-
225
- The `nexfep-load-done` event is triggered after the WebView window finishes loading:
226
-
227
- ```javascript
228
- window.addEventListener('nexfep-load-done', () => {
229
- console.log('Nexfep window loaded');
230
- });
231
- ```
232
-
233
- It can also be checked via the `window.isNexfepLoadDone` property:
234
-
235
- ```javascript
236
- if (window.isNexfepLoadDone) {
237
- // Window is ready
238
- }
239
- ```
240
-
241
- ## API
242
-
243
- ### WindowPool
244
-
245
- | Method/Property | Parameters | Return Value | Description |
246
- | ------------------------------------- | -------------------------------------------------------------------------- | ---------------- | ------------------------------------------------------------------------ |
247
- | `constructor(userDataFolder?)` | `userDataFolder`: string (optional) | WindowPool | Creates a window pool, optionally specifying the WebView2 user data directory |
248
- | `createWindow(isShow?, isDecorated?)` | `isShow`: boolean (default true), `isDecorated`: boolean (default true) | Promise\<Window> | Creates and returns a window |
249
- | `handle(event, callback)` | `event`: string, `callback`: (data: string) => void | None | Listens for the specified event, triggers callback when event is received |
250
- | `unhandle(event, callback)` | `event`: string, `callback`: (data: string) => void | None | Removes the specified callback from the event listener |
251
- | `closeWindow(window)` | `window`: Window | Promise\<void> | Closes the specified window and returns it to the pool |
252
- | `closePool()` | None | Promise\<void> | Closes the window pool and exits the application |
253
- | `mainloop()` | None | void | Starts the application main loop, blocking until the application exits |
254
- | `onCustomMessage` | `(window: Window, data: string) => void` | None | Custom message callback, triggered when receiving custom messages from pages |
255
-
256
- ### Window
257
-
258
- | Method/Property | Parameters | Return Value | Description |
259
- | ------------------------------------- | ------------------------------------------- | ---------------- | ---------------------------------------- |
260
- | `loadURL(url)` | `url`: string — URL to load | Promise\<void> | Loads the specified URL |
261
- | `loadHTML(html)` | `html`: string — HTML string | Promise\<void> | Loads the specified HTML content |
262
- | `show()` | None | void | Shows the window |
263
- | `hide()` | None | void | Hides the window |
264
- | `maximize()` | None | void | Maximizes the window |
265
- | `unMaximize()` | None | void | Restores the window (cancels maximize) |
266
- | `minimize()` | None | void | Minimizes the window |
267
- | `unMinimize()` | None | void | Restores the window (cancels minimize) |
268
- | `close()` | None | void | Closes the window and returns to pool |
269
- | `setTitle(title)` | `title`: string — Window title | void | Sets the window title |
270
- | `setDecorated(isDecorated)` | `isDecorated`: boolean — Use system decorations | void | Sets whether the window has borders and title bar |
271
- | `resizable(resizable)` | `resizable`: boolean — Resizable | void | Sets whether the window is resizable |
272
- | `openDevTools()` | None | void | Opens developer tools |
273
- | `closeDevTools()` | None | void | Closes developer tools |
274
- | `id` | None | number | Unique window identifier, auto-incrementing |
275
-
276
- ## Development
277
-
278
- ```bash
279
- pnpm install
280
- pnpm run compile
281
- ```
282
-
283
- ## License
284
-
285
- MIT License
1
+ # Nexfep
2
+
3
+ Language: English(now) | [简体中文](https://github.com/nexfteam/Nexfep/blob/main/README-CN.md)
4
+
5
+ A desktop application framework based on @webviewjs/webview
6
+
7
+ ## Project Status
8
+
9
+ **🚧 Early Stage**
10
+
11
+ This project is currently in early development, with many core capabilities for desktop application development still missing. The framework is being continuously iterated.
12
+
13
+ ## Introduction
14
+
15
+ Nexfep is a desktop application framework built on [@webviewjs/webview](https://github.com/webviewjs/webview), written in TypeScript. It aims to provide developers with a concise and efficient toolchain for building cross-platform desktop applications.
16
+
17
+ The framework uses a window pool management mechanism, supporting multi-window application scenarios such as code editors, chat tools, dashboards, etc.
18
+
19
+ ## Features
20
+
21
+ - **Window Pool Management** — Built-in window pool mechanism for automatic reuse and recycling of window resources, avoiding the overhead of frequent creation and destruction
22
+ - **IPC Communication** — Supports bidirectional message communication between the main process and WebView, via injected functions
23
+ - **Window Control** — Provides complete window operation APIs including maximize, minimize, close, title setting, and developer tools
24
+ - **Drag Regions** — Built-in HTML attribute support for defining window drag regions (`nexfep-area-drag`, etc.)
25
+ - **TypeScript Support** — Complete type definitions for excellent development experience
26
+
27
+ ## Installation
28
+
29
+ ```bash
30
+ pnpm add nexfep
31
+ ```
32
+
33
+ ## Quick Start
34
+
35
+ ```typescript
36
+ import { WindowPool } from 'nexfep';
37
+
38
+ const pool = new WindowPool();
39
+
40
+ const window = await pool.createWindow(true, false);
41
+
42
+ await window.loadHTML('<h1 nexfep-area-drag>Hello Nexfep!</h1>');
43
+
44
+ pool.mainloop();
45
+ ```
46
+
47
+ ## Usage Guide
48
+
49
+ ### Window Pool
50
+
51
+ `WindowPool` is the core management class of the framework, responsible for window creation and recycling.
52
+
53
+ ```typescript
54
+ const pool = new WindowPool();
55
+ ```
56
+
57
+ **Constructor Parameters**
58
+
59
+ - `WindowsWebview2UserDataFolder` (optional) — WebView2 user data directory, defaults to `%LOCALAPPDATA%\NexfepDevelopment.webview2-data`
60
+
61
+ ### Window Creation
62
+
63
+ ```typescript
64
+ const win = await pool.createWindow(true, false);
65
+ ```
66
+
67
+ **Parameters**
68
+
69
+ - `isShow` (boolean, default `true`) — Whether to immediately show the window
70
+ - `isDecorated` (boolean, default `true`) — Whether to use system window decorations. When set to `false`, the window has no border and requires a custom title bar
71
+
72
+ ### Window Operations
73
+
74
+ ```typescript
75
+ window.show();
76
+ window.hide();
77
+ window.maximize();
78
+ window.minimize();
79
+ window.close();
80
+ window.setTitle('New Title');
81
+ window.openDevTools();
82
+ ```
83
+
84
+ ### IPC Communication
85
+
86
+ The framework automatically injects a series of control functions after WebView page loading is complete. It is recommended to use these injected functions for IPC communication, rather than the native IPC wrapped by `@webviewjs/webview`.
87
+
88
+ #### Send Custom Messages
89
+
90
+ Send messages via `window.postMessage` in the page:
91
+
92
+ ```javascript
93
+ window.postMessage({ hello: 'world' });
94
+ ```
95
+
96
+ **Parameters**
97
+
98
+ - `data` — Any serializable data, will be serialized to JSON string before sending
99
+
100
+ #### Listen for Messages
101
+
102
+ Receive messages via `onCustomMessage` callback in the main process:
103
+
104
+ ```typescript
105
+ pool.onCustomMessage = (window, data) => {
106
+ console.log(`Message from window ${window.id}:`, data);
107
+ };
108
+ ```
109
+
110
+ **Callback Parameters**
111
+
112
+ - `window` — The window object that sent the message
113
+ - `data` — Message content, an object type (automatically converted from JSON string via `JSON.parse`)
114
+
115
+ #### Invoke Custom Events
116
+
117
+ Invoke events via `window.invoke` in the page:
118
+
119
+ ```javascript
120
+ window.invoke('hello', 'world');
121
+ ```
122
+
123
+ **Parameters**
124
+
125
+ - `event` — Event name
126
+ - `data` — Any serializable data, will be serialized to JSON string before sending
127
+
128
+ #### Listen for Events
129
+
130
+ Listen for events via `pool.handle` in the main process:
131
+
132
+ ```typescript
133
+ pool.handle('hello', (data) => {
134
+ console.log('Received event hello:', data);
135
+ });
136
+ ```
137
+
138
+ **Parameters**
139
+
140
+ - `event` — Event name, must match the event name when invoking
141
+ - `callback` — Event handler function, receives event data as `data` parameter. Can return any serializable data, which will be serialized to JSON string and sent back to the frontend as the return value of `window.invoke` (can also return nothing)
142
+
143
+ #### Remove Event Listener
144
+
145
+ Remove event listener via `pool.unhandle` in the main process:
146
+
147
+ ```typescript
148
+ pool.unhandle('hello', (data) => {
149
+ console.log('Received event hello:', data);
150
+ });
151
+ ```
152
+
153
+ **Parameters**
154
+
155
+ - `event` — Event name, must match the event name when listening
156
+ - `callback` — Event handler function, must match the callback function when listening
157
+
158
+ #### Window Control Functions
159
+
160
+ The following injected functions can be directly called in the page for window control:
161
+
162
+ ```javascript
163
+ window.close(); // Close window
164
+ window.minimize(); // Minimize window
165
+ window.unminimize(); // Restore minimized window
166
+ window.maximize(); // Maximize window
167
+ window.unmaximize(); // Restore maximized window
168
+ window.setTitle('Title'); // Set window title
169
+ window.openDevTools(); // Open developer tools
170
+ window.closeDevTools(); // Close developer tools
171
+ ```
172
+
173
+ ### Drag Regions
174
+
175
+ Define window drag regions via HTML attributes without writing additional JavaScript code. These attributes automatically apply `-webkit-app-region` and `app-region` CSS properties.
176
+
177
+ #### `nexfep-area-drag`
178
+
179
+ Makes the entire region and all its child elements draggable. Suitable for scenarios like custom title bars where the entire region needs to be draggable.
180
+
181
+ ```html
182
+ <div nexfep-area-drag>
183
+ <h1>Title Bar</h1>
184
+ <span>Subtitle</span>
185
+ </div>
186
+ ```
187
+
188
+ #### `nexfep-element-drag`
189
+
190
+ Makes only the specified element itself draggable; child elements are not affected. Suitable for scenarios requiring precise control over the drag region.
191
+
192
+ ```html
193
+ <div>
194
+ <div nexfep-element-drag>Drag Handle</div>
195
+ <p>This part is not draggable</p>
196
+ </div>
197
+ ```
198
+
199
+ #### `nexfep-no-drag`
200
+
201
+ Makes the specified region and all its child elements non-draggable. Highest priority, can override parent element's drag attributes. Suitable for interactive elements like buttons and input fields.
202
+
203
+ ```html
204
+ <div nexfep-area-drag>
205
+ <h1>Title Bar</h1>
206
+ <button nexfep-no-drag>Click Button</button>
207
+ </div>
208
+ ```
209
+
210
+ #### `nexfep-auto-drag`
211
+
212
+ Automatically determines drag regions: the entire region is draggable, but common interactive elements (`button`, `input`, `select`, `textarea`, `a`) are automatically set to non-draggable. Suitable for complex regions containing multiple interactive elements.
213
+
214
+ ```html
215
+ <div nexfep-auto-drag>
216
+ <h1>Title Bar</h1>
217
+ <button>Automatically non-draggable</button>
218
+ <input placeholder="Automatically non-draggable" />
219
+ <a href="#">Automatically non-draggable</a>
220
+ </div>
221
+ ```
222
+
223
+ ### Load Complete Event
224
+
225
+ The `nexfep-load-done` event is triggered after the WebView window finishes loading:
226
+
227
+ ```javascript
228
+ window.addEventListener('nexfep-load-done', () => {
229
+ console.log('Nexfep window loaded');
230
+ });
231
+ ```
232
+
233
+ It can also be checked via the `window.isNexfepLoadDone` property:
234
+
235
+ ```javascript
236
+ if (window.isNexfepLoadDone) {
237
+ // Window is ready
238
+ }
239
+ ```
240
+
241
+ ## API
242
+
243
+ ### WindowPool
244
+
245
+ | Method/Property | Parameters | Return Value | Description |
246
+ | ------------------------------------- | -------------------------------------------------------------------------- | ---------------- | ------------------------------------------------------------------------ |
247
+ | `constructor(userDataFolder?)` | `userDataFolder`: string (optional) | WindowPool | Creates a window pool, optionally specifying the WebView2 user data directory |
248
+ | `createWindow(isShow?, isDecorated?)` | `isShow`: boolean (default true), `isDecorated`: boolean (default true) | Promise\<Window> | Creates and returns a window |
249
+ | `handle(event, callback)` | `event`: string, `callback`: (data: string) => void | None | Listens for the specified event, triggers callback when event is received |
250
+ | `unhandle(event, callback)` | `event`: string, `callback`: (data: string) => void | None | Removes the specified callback from the event listener |
251
+ | `closeWindow(window)` | `window`: Window | Promise\<void> | Closes the specified window and returns it to the pool |
252
+ | `closePool()` | None | Promise\<void> | Closes the window pool and exits the application |
253
+ | `mainloop()` | None | void | Starts the application main loop, blocking until the application exits |
254
+ | `onCustomMessage` | `(window: Window, data: string) => void` | None | Custom message callback, triggered when receiving custom messages from pages |
255
+
256
+ ### Window
257
+
258
+ | Method/Property | Parameters | Return Value | Description |
259
+ | ------------------------------------- | ------------------------------------------- | ---------------- | ---------------------------------------- |
260
+ | `loadURL(url)` | `url`: string — URL to load | Promise\<void> | Loads the specified URL |
261
+ | `loadHTML(html)` | `html`: string — HTML string | Promise\<void> | Loads the specified HTML content |
262
+ | `show()` | None | void | Shows the window |
263
+ | `hide()` | None | void | Hides the window |
264
+ | `maximize()` | None | void | Maximizes the window |
265
+ | `unMaximize()` | None | void | Restores the window (cancels maximize) |
266
+ | `minimize()` | None | void | Minimizes the window |
267
+ | `unMinimize()` | None | void | Restores the window (cancels minimize) |
268
+ | `close()` | None | void | Closes the window and returns to pool |
269
+ | `setTitle(title)` | `title`: string — Window title | void | Sets the window title |
270
+ | `setDecorated(isDecorated)` | `isDecorated`: boolean — Use system decorations | void | Sets whether the window has borders and title bar |
271
+ | `resizable(resizable)` | `resizable`: boolean — Resizable | void | Sets whether the window is resizable |
272
+ | `openDevTools()` | None | void | Opens developer tools |
273
+ | `closeDevTools()` | None | void | Closes developer tools |
274
+ | `id` | None | number | Unique window identifier, auto-incrementing |
275
+
276
+ ## Development
277
+
278
+ ```bash
279
+ pnpm install
280
+ pnpm run compile
281
+ ```
282
+
283
+ ## License
284
+
285
+ MIT License
package/index.d.ts CHANGED
@@ -1,45 +1,45 @@
1
- import { BrowserWindow, Webview } from "@webviewjs/webview";
2
- declare class Window {
3
- window: BrowserWindow;
4
- webview: Webview;
5
- isOpen: boolean;
6
- isShow: boolean;
7
- isDecorated: boolean;
8
- id: number;
9
- private myPool;
10
- constructor(window: BrowserWindow, webview: Webview, id: number, myPool: WindowPool);
11
- setDecorated(isDecorated: boolean): void;
12
- setTitle(title: string): void;
13
- resizable(resizable: boolean): void;
14
- maximize(): void;
15
- minimize(): void;
16
- unMaximize(): void;
17
- unMinimize(): void;
18
- openDevTools(): void;
19
- closeDevTools(): void;
20
- hide(): void;
21
- show(): void;
22
- close(): void;
23
- loadURL(url: string): Promise<void>;
24
- loadHTML(html: string): Promise<void>;
25
- }
26
- declare class WindowPool {
27
- onCustomMessage: (window: Window, data: string) => void;
28
- private app;
29
- private windows;
30
- private handlers;
31
- private injectCount;
32
- private windowCount;
33
- private freeWindowCount;
34
- constructor(WindowsWebview2UserDataFolder?: string);
35
- __injectCode(window: Window, code: string): Promise<void>;
36
- __injectControlFunctions(windowObj: Window): Promise<void>;
37
- __createNewWindowObj(): Promise<Window>;
38
- createWindow(isShow?: boolean, isDecorated?: boolean): Promise<Window>;
39
- closeWindow(window: Window): Promise<void>;
40
- closePool(): Promise<void>;
41
- handle(event: string, callback: (data: any) => any): Promise<void>;
42
- unhandle(event: string, callback: (data: any) => any): Promise<void>;
43
- mainloop(): void;
44
- }
45
- export { WindowPool, Window };
1
+ import { BrowserWindow, Webview } from "@webviewjs/webview";
2
+ declare class Window {
3
+ window: BrowserWindow;
4
+ webview: Webview;
5
+ isOpen: boolean;
6
+ isShow: boolean;
7
+ isDecorated: boolean;
8
+ id: number;
9
+ private myPool;
10
+ constructor(window: BrowserWindow, webview: Webview, id: number, myPool: WindowPool);
11
+ setDecorated(isDecorated: boolean): void;
12
+ setTitle(title: string): void;
13
+ resizable(resizable: boolean): void;
14
+ maximize(): void;
15
+ minimize(): void;
16
+ unMaximize(): void;
17
+ unMinimize(): void;
18
+ openDevTools(): void;
19
+ closeDevTools(): void;
20
+ hide(): void;
21
+ show(): void;
22
+ close(): void;
23
+ loadURL(url: string): Promise<void>;
24
+ loadHTML(html: string): Promise<void>;
25
+ }
26
+ declare class WindowPool {
27
+ onCustomMessage: (window: Window, data: string) => void;
28
+ private app;
29
+ private windows;
30
+ private handlers;
31
+ private injectCount;
32
+ private windowCount;
33
+ private freeWindowCount;
34
+ constructor(WindowsWebview2UserDataFolder?: string);
35
+ __injectCode(window: Window, code: string): Promise<void>;
36
+ __injectControlFunctions(windowObj: Window): Promise<void>;
37
+ __createNewWindowObj(): Promise<Window>;
38
+ createWindow(isShow?: boolean, isDecorated?: boolean): Promise<Window>;
39
+ closeWindow(window: Window): Promise<void>;
40
+ closePool(): Promise<void>;
41
+ handle(event: string, callback: (data: any) => any): Promise<void>;
42
+ unhandle(event: string, callback: (data: any) => any): Promise<void>;
43
+ mainloop(): void;
44
+ }
45
+ export { WindowPool, Window };