@lvce-editor/main-process 6.29.0 → 6.29.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.
@@ -4666,6 +4666,21 @@ const load = async (path, env = process.env) => {
4666
4666
  }
4667
4667
  };
4668
4668
 
4669
+ const closePreparationTimeout = 1000;
4670
+ const prepareClose = async rpc => {
4671
+ let timeout;
4672
+ try {
4673
+ await Promise.race([rpc.invoke('Window.prepareClose'), new Promise((_resolve, reject) => {
4674
+ timeout = setTimeout(() => {
4675
+ reject(new Error(`Timed out preparing window close after ${closePreparationTimeout}ms`));
4676
+ }, closePreparationTimeout);
4677
+ })]);
4678
+ } finally {
4679
+ if (timeout) {
4680
+ clearTimeout(timeout);
4681
+ }
4682
+ }
4683
+ };
4669
4684
  const createWindowCloseHandler = (window, rpc, onError, dispose = () => {}) => {
4670
4685
  let closePending = false;
4671
4686
  const handleWindowClose = event => {
@@ -4676,7 +4691,7 @@ const createWindowCloseHandler = (window, rpc, onError, dispose = () => {}) => {
4676
4691
  closePending = true;
4677
4692
  void (async () => {
4678
4693
  try {
4679
- await rpc.invoke('Window.prepareClose');
4694
+ await prepareClose(rpc);
4680
4695
  } catch (error) {
4681
4696
  onError(error);
4682
4697
  } finally {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lvce-editor/main-process",
3
- "version": "6.29.0",
3
+ "version": "6.29.1",
4
4
  "keywords": [
5
5
  "lvce-editor",
6
6
  "electron"