ewvjs 1.0.8 → 1.0.10

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 (74) hide show
  1. package/README.md +3 -3
  2. package/dist/index.d.ts +5 -5
  3. package/dist/index.d.ts.map +1 -1
  4. package/dist/index.js +11 -52
  5. package/dist/platforms/windows.d.ts.map +1 -1
  6. package/dist/platforms/windows.js +9 -41
  7. package/dist/types.js +1 -2
  8. package/dist/utils.d.ts.map +1 -1
  9. package/dist/utils.js +44 -10
  10. package/dist/webview.d.ts +6 -2
  11. package/dist/webview.d.ts.map +1 -1
  12. package/dist/webview.js +139 -47
  13. package/dist/window.d.ts +7 -13
  14. package/dist/window.d.ts.map +1 -1
  15. package/dist/window.js +187 -250
  16. package/native/Microsoft.Bcl.AsyncInterfaces.dll +0 -0
  17. package/native/Microsoft.Web.WebView2.WinForms.dll +0 -0
  18. package/native/Microsoft.Web.WebView2.Wpf.dll +0 -0
  19. package/native/System.Buffers.dll +0 -0
  20. package/native/System.Collections.Immutable.dll +0 -0
  21. package/native/System.Memory.dll +0 -0
  22. package/native/System.Numerics.Vectors.dll +0 -0
  23. package/native/System.Reflection.Metadata.dll +0 -0
  24. package/native/System.Reflection.MetadataLoadContext.dll +0 -0
  25. package/native/System.Runtime.CompilerServices.Unsafe.dll +0 -0
  26. package/native/System.Text.Encoding.CodePages.dll +0 -0
  27. package/native/System.Text.Encodings.Web.dll +0 -0
  28. package/native/System.Text.Json.dll +0 -0
  29. package/native/System.Threading.Tasks.Extensions.dll +0 -0
  30. package/native/System.ValueTuple.dll +0 -0
  31. package/native/WebView.cjs +1 -1
  32. package/native/WebView.deps.json +117 -101
  33. package/native/WebView.dll +0 -0
  34. package/native/WebView.mjs +1 -1
  35. package/package.json +56 -55
  36. package/native/node_modules/node-api-dotnet/README.md +0 -80
  37. package/native/node_modules/node-api-dotnet/index.d.ts +0 -98
  38. package/native/node_modules/node-api-dotnet/linux-arm64/Microsoft.JavaScript.NodeApi.node +0 -0
  39. package/native/node_modules/node-api-dotnet/linux-x64/Microsoft.JavaScript.NodeApi.node +0 -0
  40. package/native/node_modules/node-api-dotnet/net10.0/Microsoft.JavaScript.NodeApi.DotNetHost.dll +0 -0
  41. package/native/node_modules/node-api-dotnet/net10.0/Microsoft.JavaScript.NodeApi.dll +0 -0
  42. package/native/node_modules/node-api-dotnet/net10.0/Microsoft.JavaScript.NodeApi.runtimeconfig.json +0 -14
  43. package/native/node_modules/node-api-dotnet/net10.0.js +0 -2
  44. package/native/node_modules/node-api-dotnet/net472.d.ts +0 -2
  45. package/native/node_modules/node-api-dotnet/net8.0/Microsoft.JavaScript.NodeApi.DotNetHost.dll +0 -0
  46. package/native/node_modules/node-api-dotnet/net8.0/Microsoft.JavaScript.NodeApi.dll +0 -0
  47. package/native/node_modules/node-api-dotnet/net8.0/Microsoft.JavaScript.NodeApi.runtimeconfig.json +0 -14
  48. package/native/node_modules/node-api-dotnet/net8.0.d.ts +0 -2
  49. package/native/node_modules/node-api-dotnet/net8.0.js +0 -2
  50. package/native/node_modules/node-api-dotnet/net9.0/Microsoft.JavaScript.NodeApi.DotNetHost.dll +0 -0
  51. package/native/node_modules/node-api-dotnet/net9.0/Microsoft.JavaScript.NodeApi.dll +0 -0
  52. package/native/node_modules/node-api-dotnet/net9.0/Microsoft.JavaScript.NodeApi.runtimeconfig.json +0 -14
  53. package/native/node_modules/node-api-dotnet/net9.0.d.ts +0 -2
  54. package/native/node_modules/node-api-dotnet/net9.0.js +0 -2
  55. package/native/node_modules/node-api-dotnet/osx-arm64/Microsoft.JavaScript.NodeApi.node +0 -0
  56. package/native/node_modules/node-api-dotnet/osx-x64/Microsoft.JavaScript.NodeApi.node +0 -0
  57. package/native/node_modules/node-api-dotnet/package.json +0 -27
  58. package/src/README.md +0 -125
  59. package/src/csharp/bin/Release/net10.0-windows/Microsoft.Web.WebView2.Core.dll +0 -0
  60. package/src/csharp/bin/Release/net10.0-windows/Microsoft.Web.WebView2.Core.xml +0 -6817
  61. package/src/csharp/bin/Release/net10.0-windows/Microsoft.Web.WebView2.WinForms.dll +0 -0
  62. package/src/csharp/bin/Release/net10.0-windows/Microsoft.Web.WebView2.WinForms.xml +0 -510
  63. package/src/csharp/bin/Release/net10.0-windows/Microsoft.Web.WebView2.Wpf.dll +0 -0
  64. package/src/csharp/bin/Release/net10.0-windows/Microsoft.Web.WebView2.Wpf.xml +0 -1902
  65. package/src/csharp/bin/Release/net10.0-windows/WebView.cjs +0 -26
  66. package/src/csharp/bin/Release/net10.0-windows/WebView.d.ts +0 -8
  67. package/src/csharp/bin/Release/net10.0-windows/WebView.deps.json +0 -260
  68. package/src/csharp/bin/Release/net10.0-windows/WebView.dll +0 -0
  69. package/src/csharp/bin/Release/net10.0-windows/WebView.mjs +0 -31
  70. package/src/csharp/bin/Release/net10.0-windows/WebView.pdb +0 -0
  71. package/src/csharp/bin/Release/net10.0-windows/import.cjs +0 -3
  72. package/src/csharp/bin/Release/net10.0-windows/runtimes/win-arm64/native/WebView2Loader.dll +0 -0
  73. package/src/csharp/bin/Release/net10.0-windows/runtimes/win-x64/native/WebView2Loader.dll +0 -0
  74. package/src/csharp/bin/Release/net10.0-windows/runtimes/win-x86/native/WebView2Loader.dll +0 -0
package/dist/window.js CHANGED
@@ -1,34 +1,29 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.Window = void 0;
13
- const utils_1 = require("./utils");
14
- class Window {
1
+ import { getParamNames, generateId } from "./utils.js";
2
+ export class Window {
3
+ platform;
4
+ options;
5
+ controller;
6
+ _closedPromise;
7
+ _resolveClosed;
8
+ _menuCallbacks = new Map();
9
+ _exposedFunctions;
10
+ _isClosed = false;
11
+ _pendingApiInjection = null;
12
+ on_context_menu = () => null;
15
13
  constructor(platform, options, exposedFunctions) {
16
- this._menuCallbacks = new Map();
17
- this._isClosed = false;
18
- this.on_context_menu = () => null;
19
14
  this.platform = platform;
20
- this.options = Object.assign({}, options);
15
+ this.options = { ...options };
21
16
  this._exposedFunctions = exposedFunctions;
22
17
  this._closedPromise = new Promise((resolve) => {
23
18
  this._resolveClosed = resolve;
24
19
  });
25
20
  const originalCallback = this.options.jsCallback;
26
- this.options.jsCallback = (msg) => __awaiter(this, void 0, void 0, function* () {
27
- const result = yield this._on_message(msg, this._exposedFunctions);
21
+ this.options.jsCallback = async (msg) => {
22
+ const result = await this._on_message(msg, this._exposedFunctions);
28
23
  if (originalCallback)
29
- yield originalCallback(msg);
24
+ await originalCallback(msg);
30
25
  return result;
31
- });
26
+ };
32
27
  }
33
28
  get closed() {
34
29
  return this._closedPromise;
@@ -36,239 +31,190 @@ class Window {
36
31
  get is_closed() {
37
32
  return this._isClosed;
38
33
  }
39
- run() {
40
- return __awaiter(this, void 0, void 0, function* () {
41
- this.controller = yield this.platform.createWindow(this.options);
42
- // Inject exposed functions API
43
- const funcList = Object.keys(this._exposedFunctions).map(name => {
44
- return { func: name, params: (0, utils_1.getParamNames)(this._exposedFunctions[name]) };
45
- });
46
- if (funcList.length > 0) {
47
- const code = `if (window.ewvjs) { window.ewvjs._createApi(${JSON.stringify(funcList)}); }`;
48
- setTimeout(() => this.evaluate_js(code).catch((err) => {
49
- console.error('Failed to inject exposed functions API:', err);
50
- }), 500);
51
- }
52
- return this.controller;
34
+ async run() {
35
+ this.controller = await this.platform.createWindow(this.options);
36
+ // Inject exposed functions API after DOM is ready
37
+ const funcList = Object.keys(this._exposedFunctions).map((name) => {
38
+ return {
39
+ func: name,
40
+ params: getParamNames(this._exposedFunctions[name]),
41
+ };
53
42
  });
43
+ if (funcList.length > 0) {
44
+ const code = `window.ewvjs._createApi(${JSON.stringify(funcList)});`;
45
+ this._pendingApiInjection = code;
46
+ }
47
+ return this.controller;
54
48
  }
55
- _call(method_1) {
56
- return __awaiter(this, arguments, void 0, function* (method, payload = null) {
57
- if (this._isClosed) {
58
- console.warn(`Cannot call ${method}: Window is closed`);
59
- return null;
60
- }
61
- if (!this.controller || !this.controller[method]) {
62
- throw new Error(`Window not running or ${method} not supported`);
49
+ async _call(method, payload = null) {
50
+ if (this._isClosed) {
51
+ console.warn(`Cannot call ${method}: Window is closed`);
52
+ return null;
53
+ }
54
+ if (!this.controller || !this.controller[method]) {
55
+ throw new Error(`Window not running or ${method} not supported`);
56
+ }
57
+ try {
58
+ const result = this.controller[method](payload);
59
+ // Check if method returns a Promise (node-api-dotnet JSCallback style)
60
+ if (result && typeof result.then === "function") {
61
+ return result;
63
62
  }
64
- try {
65
- const result = this.controller[method](payload);
66
- // Check if method returns a Promise (node-api-dotnet JSCallback style)
67
- if (result && typeof result.then === 'function') {
68
- return result;
69
- }
70
- else {
71
- return result;
72
- }
63
+ else {
64
+ return result;
73
65
  }
74
- catch (err) {
75
- // If window was closed mid-operation, mark as closed and return null
76
- if (err && err.message && err.message.includes('Window not initialized')) {
77
- this._isClosed = true;
78
- console.warn(`Window was closed during ${method} call`);
79
- return null;
80
- }
81
- throw err;
66
+ }
67
+ catch (err) {
68
+ // If window was closed mid-operation, mark as closed and return null
69
+ if (err &&
70
+ err.message &&
71
+ err.message.includes("Window not initialized")) {
72
+ this._isClosed = true;
73
+ console.warn(`Window was closed during ${method} call`);
74
+ return null;
82
75
  }
83
- });
76
+ throw err;
77
+ }
84
78
  }
85
79
  // Core methods
86
- evaluate_js(script) {
87
- return __awaiter(this, void 0, void 0, function* () {
88
- return this._call('evaluate', script);
89
- });
90
- }
91
- evaluate(script) {
92
- return __awaiter(this, void 0, void 0, function* () {
93
- return this.evaluate_js(script);
94
- });
80
+ async evaluate(script) {
81
+ return this._call("evaluate", script);
95
82
  }
96
- close() {
97
- return __awaiter(this, void 0, void 0, function* () {
98
- if (this._isClosed)
99
- return;
100
- this._isClosed = true;
101
- const result = yield this._call('close');
102
- this._resolveClosed();
103
- return result;
104
- });
83
+ async close() {
84
+ if (this._isClosed)
85
+ return;
86
+ this._isClosed = true;
87
+ const result = await this._call("close");
88
+ this._resolveClosed();
89
+ return result;
105
90
  }
106
- destroy() {
107
- return __awaiter(this, void 0, void 0, function* () {
108
- return this._call('close');
109
- });
91
+ async destroy() {
92
+ return this._call("close");
110
93
  }
111
94
  // Window state methods
112
- maximize() {
113
- return __awaiter(this, void 0, void 0, function* () { return this._call('maximize'); });
95
+ async maximize() {
96
+ return this._call("maximize");
114
97
  }
115
- restore() {
116
- return __awaiter(this, void 0, void 0, function* () { return this._call('restore'); });
98
+ async restore() {
99
+ return this._call("restore");
117
100
  }
118
- minimize() {
119
- return __awaiter(this, void 0, void 0, function* () { return this._call('minimize'); });
101
+ async minimize() {
102
+ return this._call("minimize");
120
103
  }
121
- focus() {
122
- return __awaiter(this, void 0, void 0, function* () { return this._call('focus'); });
104
+ async focus() {
105
+ return this._call("focus");
123
106
  }
124
- show() {
125
- return __awaiter(this, void 0, void 0, function* () { return this._call('show'); });
107
+ async show() {
108
+ return this._call("show");
126
109
  }
127
- hide() {
128
- return __awaiter(this, void 0, void 0, function* () { return this._call('hide'); });
110
+ async hide() {
111
+ return this._call("hide");
129
112
  }
130
113
  // Size and position methods
131
- getSize() {
132
- return __awaiter(this, void 0, void 0, function* () { return this._call('getSize'); });
133
- }
134
- setSize(width, height) {
135
- return __awaiter(this, void 0, void 0, function* () {
136
- return this._call('setSize', { width, height });
137
- });
114
+ async getSize() {
115
+ return this._call("getSize");
138
116
  }
139
- resize(width, height) {
140
- return __awaiter(this, void 0, void 0, function* () {
141
- return this._call('setSize', { width, height });
142
- });
117
+ async setSize(width, height) {
118
+ return this._call("setSize", { width, height });
143
119
  }
144
- getMinSize() {
145
- return __awaiter(this, void 0, void 0, function* () { return this._call('getMinSize'); });
120
+ async resize(width, height) {
121
+ return this._call("setSize", { width, height });
146
122
  }
147
- setMinSize(width, height) {
148
- return __awaiter(this, void 0, void 0, function* () {
149
- return this._call('setMinSize', { width, height });
150
- });
123
+ async getMinSize() {
124
+ return this._call("getMinSize");
151
125
  }
152
- set_min_size(width, height) {
153
- return __awaiter(this, void 0, void 0, function* () {
154
- return this._call('setMinSize', { width, height });
155
- });
126
+ async setMinSize(width, height) {
127
+ return this._call("setMinSize", { width, height });
156
128
  }
157
- getPosition() {
158
- return __awaiter(this, void 0, void 0, function* () { return this._call('getPosition'); });
129
+ async getPosition() {
130
+ return this._call("getPosition");
159
131
  }
160
- setPosition(x, y) {
161
- return __awaiter(this, void 0, void 0, function* () {
162
- return this._call('setPosition', { x, y });
163
- });
132
+ async setPosition(x, y) {
133
+ return this._call("setPosition", { x, y });
164
134
  }
165
- move(x, y) {
166
- return __awaiter(this, void 0, void 0, function* () {
167
- return this._call('move', { x, y });
168
- });
169
- }
170
- get_position() {
171
- return __awaiter(this, void 0, void 0, function* () { return this._call('getPosition'); });
172
- }
173
- set_position(x, y) {
174
- return __awaiter(this, void 0, void 0, function* () {
175
- return this._call('setPosition', { x, y });
176
- });
177
- }
178
- get_width() {
179
- return __awaiter(this, void 0, void 0, function* () {
180
- const size = yield this._call('getSize');
181
- return size.width;
182
- });
183
- }
184
- get_height() {
185
- return __awaiter(this, void 0, void 0, function* () {
186
- const size = yield this._call('getSize');
187
- return size.height;
188
- });
135
+ async move(x, y) {
136
+ return this._call("move", { x, y });
189
137
  }
190
138
  // Title methods
191
- setTitle(title) {
192
- return __awaiter(this, void 0, void 0, function* () {
193
- return this._call('setTitle', title);
194
- });
195
- }
196
- set_title(title) {
197
- return __awaiter(this, void 0, void 0, function* () {
198
- return this._call('setTitle', title);
199
- });
139
+ async setTitle(title) {
140
+ return this._call("setTitle", title);
200
141
  }
201
142
  // Title bar methods
202
- show_titlebar() {
203
- return __awaiter(this, void 0, void 0, function* () { return this._call('setTitleBar', true); });
143
+ async showTitlebar() {
144
+ return this._call("setTitleBar", true);
204
145
  }
205
- hide_titlebar() {
206
- return __awaiter(this, void 0, void 0, function* () { return this._call('setTitleBar', false); });
146
+ async hideTitlebar() {
147
+ return this._call("setTitleBar", false);
207
148
  }
208
149
  // Icon methods
209
- setIcon(iconPath) {
210
- return __awaiter(this, void 0, void 0, function* () {
211
- return this._call('setIcon', iconPath);
212
- });
150
+ async setIcon(iconPath) {
151
+ return this._call("setIcon", iconPath);
213
152
  }
214
153
  // Cookie methods
215
- get_cookies() {
216
- return __awaiter(this, void 0, void 0, function* () { return this._call('getCookies'); });
154
+ async getCookies() {
155
+ return this._call("getCookies");
217
156
  }
218
- set_cookie(name_1, value_1) {
219
- return __awaiter(this, arguments, void 0, function* (name, value, domain = '', path = '/') {
220
- return this._call('setCookie', { name, value, domain, path });
221
- });
157
+ async setCookie(name, value, domain = "", path = "/") {
158
+ return this._call("setCookie", { name, value, domain, path });
222
159
  }
223
- clear_cookies() {
224
- return __awaiter(this, void 0, void 0, function* () { return this._call('clearCookies'); });
225
- }
226
- _on_message(message, exposedFunctions) {
227
- return __awaiter(this, void 0, void 0, function* () {
228
- try {
229
- const data = typeof message === 'string' ? JSON.parse(message) : message;
230
- if (!Array.isArray(data))
231
- return null;
232
- const funcName = data[0];
233
- const rawParams = data[1];
234
- const id = data[2];
235
- const params = this._parseParams(rawParams);
236
- // Handle special messages
237
- if (funcName === 'closed') {
238
- this._isClosed = true;
239
- this._resolveClosed();
240
- return null;
241
- }
242
- if (funcName === 'console') {
243
- console.log('WebView Console:', ...params);
244
- return null;
245
- }
246
- if (funcName === 'menu_click') {
247
- return this._handleMenuClick(params);
248
- }
249
- if (funcName === 'context_menu_requested') {
250
- return this._handleContextMenu(params);
251
- }
252
- // Handle window state methods
253
- if (funcName.startsWith('window_')) {
254
- const method = funcName.substring(7); // Remove 'window_' prefix
255
- if (typeof this[method] === 'function') {
256
- yield this[method]();
257
- }
258
- return null;
160
+ async clearCookies() {
161
+ return this._call("clearCookies");
162
+ }
163
+ async _on_message(message, exposedFunctions) {
164
+ try {
165
+ const data = typeof message === "string" ? JSON.parse(message) : message;
166
+ if (!Array.isArray(data))
167
+ return null;
168
+ const funcName = data[0];
169
+ const rawParams = data[1];
170
+ const id = data[2];
171
+ const params = this._parseParams(rawParams);
172
+ // Handle special messages
173
+ if (funcName === "closed") {
174
+ this._isClosed = true;
175
+ this._resolveClosed();
176
+ return null;
177
+ }
178
+ if (funcName === "dom_ready") {
179
+ // DOM is ready, inject the API now
180
+ if (this._pendingApiInjection) {
181
+ await this.evaluate(this._pendingApiInjection).catch((err) => {
182
+ console.error("Failed to inject exposed functions API:", err);
183
+ });
184
+ this._pendingApiInjection = null;
259
185
  }
260
- // Handle exposed function calls
261
- return this._handleExposedFunction(funcName, params, id, exposedFunctions);
186
+ return null;
262
187
  }
263
- catch (e) {
188
+ if (funcName === "console") {
189
+ console.log("WebView Console:", ...params);
264
190
  return null;
265
191
  }
266
- });
192
+ if (funcName === "menu_click") {
193
+ return this._handleMenuClick(params);
194
+ }
195
+ if (funcName === "context_menu_requested") {
196
+ return this._handleContextMenu(params);
197
+ }
198
+ // Handle window state methods
199
+ if (funcName.startsWith("window_")) {
200
+ const method = funcName.substring(7); // Remove 'window_' prefix
201
+ if (typeof this[method] === "function") {
202
+ await this[method]();
203
+ }
204
+ return null;
205
+ }
206
+ // Handle exposed function calls
207
+ return this._handleExposedFunction(funcName, params, id, exposedFunctions);
208
+ }
209
+ catch (e) {
210
+ return null;
211
+ }
267
212
  }
268
213
  _parseParams(rawParams) {
269
214
  let params = [];
270
215
  if (rawParams) {
271
- if (typeof rawParams === 'string' && (rawParams.startsWith('[') || rawParams.startsWith('{'))) {
216
+ if (typeof rawParams === "string" &&
217
+ (rawParams.startsWith("[") || rawParams.startsWith("{"))) {
272
218
  try {
273
219
  const parsed = JSON.parse(rawParams);
274
220
  params = Array.isArray(parsed) ? parsed : [parsed];
@@ -290,52 +236,44 @@ class Window {
290
236
  callback();
291
237
  return null;
292
238
  }
293
- _handleContextMenu(params) {
294
- return __awaiter(this, void 0, void 0, function* () {
295
- if (this.on_context_menu) {
296
- const customMenu = yield this.on_context_menu(params);
297
- if (customMenu) {
298
- return this._processMenu(customMenu);
299
- }
239
+ async _handleContextMenu(params) {
240
+ if (this.on_context_menu) {
241
+ const customMenu = await this.on_context_menu(params);
242
+ if (customMenu) {
243
+ return this._processMenu(customMenu);
300
244
  }
301
- return null;
302
- });
245
+ }
246
+ return null;
303
247
  }
304
- _handleExposedFunction(funcName, params, id, exposedFunctions) {
305
- return __awaiter(this, void 0, void 0, function* () {
306
- const func = exposedFunctions[funcName];
307
- if (!func)
308
- return null;
309
- try {
310
- const result = yield func(...params);
311
- yield this._sendSuccessResponse(funcName, id, result);
312
- return result !== undefined ? result : null;
313
- }
314
- catch (err) {
315
- yield this._sendErrorResponse(funcName, id, err);
316
- return null;
317
- }
318
- });
248
+ async _handleExposedFunction(funcName, params, id, exposedFunctions) {
249
+ const func = exposedFunctions[funcName];
250
+ if (!func)
251
+ return null;
252
+ try {
253
+ const result = await func(...params);
254
+ await this._sendSuccessResponse(funcName, id, result);
255
+ return result !== undefined ? result : null;
256
+ }
257
+ catch (err) {
258
+ await this._sendErrorResponse(funcName, id, err);
259
+ return null;
260
+ }
319
261
  }
320
- _sendSuccessResponse(funcName, id, result) {
321
- return __awaiter(this, void 0, void 0, function* () {
322
- const resJson = JSON.stringify(result);
323
- const code = `window.ewvjs._returnValuesCallbacks["${funcName}"]["${id}"]({value: ${JSON.stringify(resJson)}, isError: false})`;
324
- yield this.evaluate_js(code);
325
- });
262
+ async _sendSuccessResponse(funcName, id, result) {
263
+ const resJson = JSON.stringify(result);
264
+ const code = `window.ewvjs._returnValuesCallbacks["${funcName}"]["${id}"]({value: ${JSON.stringify(resJson)}, isError: false})`;
265
+ await this.evaluate(code);
326
266
  }
327
- _sendErrorResponse(funcName, id, err) {
328
- return __awaiter(this, void 0, void 0, function* () {
329
- const errObj = { message: err.message, name: err.name, stack: err.stack };
330
- const code = `window.ewvjs._returnValuesCallbacks["${funcName}"]["${id}"]({value: ${JSON.stringify(JSON.stringify(errObj))}, isError: true})`;
331
- yield this.evaluate_js(code);
332
- });
267
+ async _sendErrorResponse(funcName, id, err) {
268
+ const errObj = { message: err.message, name: err.name, stack: err.stack };
269
+ const code = `window.ewvjs._returnValuesCallbacks["${funcName}"]["${id}"]({value: ${JSON.stringify(JSON.stringify(errObj))}, isError: true})`;
270
+ await this.evaluate(code);
333
271
  }
334
272
  _processMenu(menu) {
335
273
  return menu.map((item) => {
336
- const newItem = Object.assign({}, item);
274
+ const newItem = { ...item };
337
275
  if (newItem.click) {
338
- const id = newItem.id || (0, utils_1.generateId)();
276
+ const id = newItem.id || generateId();
339
277
  newItem.id = id;
340
278
  this._menuCallbacks.set(id, newItem.click);
341
279
  delete newItem.click;
@@ -347,4 +285,3 @@ class Window {
347
285
  });
348
286
  }
349
287
  }
350
- exports.Window = Window;
Binary file
Binary file
Binary file
Binary file
@@ -2,7 +2,7 @@
2
2
  // Generated by: Microsoft.JavaScript.NodeApi.Generator 0.9.0.0
3
3
  /* eslint-disable */
4
4
 
5
- const dotnet = require('node-api-dotnet/net10.0');
5
+ const dotnet = require('node-api-dotnet/net472');
6
6
  const path = require('node:path');
7
7
  // @ts-ignore - https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/65252
8
8
  const { dlopen, platform, arch } = require('node:process');