@lvce-editor/main-process 6.29.0 → 6.29.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.
- package/dist/mainProcessMain.js +20 -2
- package/package.json +1 -1
package/dist/mainProcessMain.js
CHANGED
|
@@ -2284,13 +2284,16 @@ const listen$2$1 = ({
|
|
|
2284
2284
|
return webContents;
|
|
2285
2285
|
};
|
|
2286
2286
|
const getData$1 = (event, message) => {
|
|
2287
|
+
if (!message || !('method' in message)) {
|
|
2288
|
+
return message;
|
|
2289
|
+
}
|
|
2287
2290
|
const {
|
|
2288
2291
|
ports,
|
|
2289
2292
|
sender
|
|
2290
2293
|
} = event;
|
|
2291
2294
|
const data = {
|
|
2292
2295
|
...message,
|
|
2293
|
-
params: [...message.params, ...ports, sender.id]
|
|
2296
|
+
params: [...(Array.isArray(message.params) ? message.params : []), ...ports, sender.id]
|
|
2294
2297
|
};
|
|
2295
2298
|
return data;
|
|
2296
2299
|
};
|
|
@@ -4666,6 +4669,21 @@ const load = async (path, env = process.env) => {
|
|
|
4666
4669
|
}
|
|
4667
4670
|
};
|
|
4668
4671
|
|
|
4672
|
+
const closePreparationTimeout = 1000;
|
|
4673
|
+
const prepareClose = async rpc => {
|
|
4674
|
+
let timeout;
|
|
4675
|
+
try {
|
|
4676
|
+
await Promise.race([rpc.invoke('Window.prepareClose'), new Promise((_resolve, reject) => {
|
|
4677
|
+
timeout = setTimeout(() => {
|
|
4678
|
+
reject(new Error(`Timed out preparing window close after ${closePreparationTimeout}ms`));
|
|
4679
|
+
}, closePreparationTimeout);
|
|
4680
|
+
})]);
|
|
4681
|
+
} finally {
|
|
4682
|
+
if (timeout) {
|
|
4683
|
+
clearTimeout(timeout);
|
|
4684
|
+
}
|
|
4685
|
+
}
|
|
4686
|
+
};
|
|
4669
4687
|
const createWindowCloseHandler = (window, rpc, onError, dispose = () => {}) => {
|
|
4670
4688
|
let closePending = false;
|
|
4671
4689
|
const handleWindowClose = event => {
|
|
@@ -4676,7 +4694,7 @@ const createWindowCloseHandler = (window, rpc, onError, dispose = () => {}) => {
|
|
|
4676
4694
|
closePending = true;
|
|
4677
4695
|
void (async () => {
|
|
4678
4696
|
try {
|
|
4679
|
-
await rpc
|
|
4697
|
+
await prepareClose(rpc);
|
|
4680
4698
|
} catch (error) {
|
|
4681
4699
|
onError(error);
|
|
4682
4700
|
} finally {
|