@raydiant/playlist-window-manager 0.28.2-rc2 → 0.28.2-rc3

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.
@@ -905,7 +905,7 @@ var PlaylistWindowManager = /** @class */ (function (_super) {
905
905
  };
906
906
  PlaylistWindowManager.prototype.swapWindows = function () {
907
907
  return __awaiter(this, void 0, void 0, function () {
908
- var nextPreviewPresentationId, preview, result, nextPresentation, shouldPreload;
908
+ var nextPreviewPresentationId, preview, result, nextPresentation, shouldPreload, closeWindowPromise;
909
909
  return __generator(this, function (_a) {
910
910
  switch (_a.label) {
911
911
  case 0:
@@ -941,19 +941,22 @@ var PlaylistWindowManager = /** @class */ (function (_super) {
941
941
  if (this.nextWindow) {
942
942
  this.nextWindow.show(this.isFocused);
943
943
  }
944
- if (!this.currentWindow) return [3 /*break*/, 4];
945
- if (!(this.options.closeWindowDelayMs !== undefined)) return [3 /*break*/, 2];
946
- return [4 /*yield*/, delay(this.options.closeWindowDelayMs)];
944
+ if (!this.currentWindow) return [3 /*break*/, 2];
945
+ // TODO: Kind of a hack, could use win.on('show') event to trigger hide?
946
+ // Would only work in electron environment so need to do in BrowserWindowRenderer.
947
+ // Should show be async then?
948
+ // Or try paintWhenInitiallyHidden: false?
949
+ if (this.options.closeWindowDelayMs !== undefined) {
950
+ // Don't await here because this will cause a slight delay when playing the next window.
951
+ // Instead we want to wait for window close at the end of this method.
952
+ closeWindowPromise = delay(this.options.closeWindowDelayMs);
953
+ }
954
+ this.currentWindow.hide();
955
+ return [4 /*yield*/, this.removeCurrentWindow()];
947
956
  case 1:
948
957
  _a.sent();
949
958
  _a.label = 2;
950
959
  case 2:
951
- this.currentWindow.hide();
952
- return [4 /*yield*/, this.removeCurrentWindow()];
953
- case 3:
954
- _a.sent();
955
- _a.label = 4;
956
- case 4:
957
960
  // Swap windows.
958
961
  this.currentWindow = this.nextWindow;
959
962
  if (this.currentWindow) {
@@ -981,7 +984,12 @@ var PlaylistWindowManager = /** @class */ (function (_super) {
981
984
  this.nextWindow = null;
982
985
  this.nextPresentation = null;
983
986
  }
984
- return [2 /*return*/];
987
+ if (!closeWindowPromise) return [3 /*break*/, 4];
988
+ return [4 /*yield*/, closeWindowPromise];
989
+ case 3:
990
+ _a.sent();
991
+ _a.label = 4;
992
+ case 4: return [2 /*return*/];
985
993
  }
986
994
  });
987
995
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raydiant/playlist-window-manager",
3
- "version": "0.28.2-rc2",
3
+ "version": "0.28.2-rc3",
4
4
  "description": "Window manager for playlist playback.",
5
5
  "main": "build/index.js",
6
6
  "scripts": {
@@ -753,13 +753,16 @@ export default class PlaylistWindowManager extends EventEmitter {
753
753
 
754
754
  // If current window isn't defined we don't need to hide it but we still
755
755
  // want to make the next window the new current window.
756
+ let closeWindowPromise;
756
757
  if (this.currentWindow) {
757
758
  // TODO: Kind of a hack, could use win.on('show') event to trigger hide?
758
759
  // Would only work in electron environment so need to do in BrowserWindowRenderer.
759
760
  // Should show be async then?
760
761
  // Or try paintWhenInitiallyHidden: false?
761
762
  if (this.options.closeWindowDelayMs !== undefined) {
762
- await delay(this.options.closeWindowDelayMs);
763
+ // Don't await here because this will cause a slight delay when playing the next window.
764
+ // Instead we want to wait for window close at the end of this method.
765
+ closeWindowPromise = delay(this.options.closeWindowDelayMs);
763
766
  }
764
767
  this.currentWindow.hide();
765
768
  await this.removeCurrentWindow();
@@ -795,6 +798,10 @@ export default class PlaylistWindowManager extends EventEmitter {
795
798
  this.nextWindow = null;
796
799
  this.nextPresentation = null;
797
800
  }
801
+
802
+ if (closeWindowPromise) {
803
+ await closeWindowPromise;
804
+ }
798
805
  }
799
806
 
800
807
  private evalRuleEngine(warnIfPreloadMismatch = true): EvalRuleEngineResult {