@raydiant/playlist-window-manager 0.28.2-rc4 → 0.28.2-rc5

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.
@@ -128,7 +128,6 @@ var BrowserWindowRenderer = /** @class */ (function () {
128
128
  },
129
129
  })
130
130
  : this.createOrGetPooledBrowserWindow(windowId, {
131
- paintWhenInitiallyHidden: false,
132
131
  show: false,
133
132
  /**
134
133
  * This option fixes window not being able to take fullscreen leaving
@@ -946,14 +946,20 @@ var PlaylistWindowManager = /** @class */ (function (_super) {
946
946
  // Don't await here because this will cause a slight delay when playing the next window.
947
947
  // Instead we want to wait for window close at the end of this method.
948
948
  closeWindowPromise = new Promise(function (resolve) {
949
+ // Capture the current window reference to close because this.currentWindow will be
950
+ // set to the next window before the timeout fires.
951
+ var windowToClose = _this.currentWindow;
949
952
  setTimeout(function () { return __awaiter(_this, void 0, void 0, function () {
950
953
  return __generator(this, function (_a) {
951
954
  switch (_a.label) {
952
955
  case 0:
953
- if (!this.currentWindow) return [3 /*break*/, 2];
954
- this.currentWindow.hide();
955
- return [4 /*yield*/, this.removeCurrentWindow()];
956
+ if (!windowToClose) return [3 /*break*/, 2];
957
+ // TODO: Do we need to check if the window is already removed/destroyed?
958
+ // TODO: Add a guard in BrowserWindowRenderer.removeWindow to check if the window is destroyed?
959
+ return [4 /*yield*/, windowToClose.remove()];
956
960
  case 1:
961
+ // TODO: Do we need to check if the window is already removed/destroyed?
962
+ // TODO: Add a guard in BrowserWindowRenderer.removeWindow to check if the window is destroyed?
957
963
  _a.sent();
958
964
  _a.label = 2;
959
965
  case 2:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raydiant/playlist-window-manager",
3
- "version": "0.28.2-rc4",
3
+ "version": "0.28.2-rc5",
4
4
  "description": "Window manager for playlist playback.",
5
5
  "main": "build/index.js",
6
6
  "scripts": {
@@ -22,7 +22,7 @@
22
22
  "@types/jschannel": "^1.0.1",
23
23
  "@types/jest": "^24.0.15",
24
24
  "@types/uuid": "8.3.0",
25
- "electron": "28.1.2",
25
+ "electron": "38.0.0",
26
26
  "jest": "^24.8.0",
27
27
  "ts-jest": "^24.0.2",
28
28
  "typescript": "^4.1.2"
@@ -114,7 +114,6 @@ export default class BrowserWindowRenderer
114
114
  },
115
115
  })
116
116
  : this.createOrGetPooledBrowserWindow(windowId, {
117
- paintWhenInitiallyHidden: false,
118
117
  show: false,
119
118
  /**
120
119
  * This option fixes window not being able to take fullscreen leaving
@@ -749,22 +749,27 @@ export default class PlaylistWindowManager extends EventEmitter {
749
749
  this.nextWindow.show(this.isFocused);
750
750
  }
751
751
 
752
+ // If current window isn't defined we don't need to hide it but we still
753
+ // want to make the next window the new current window.
752
754
  // If current window isn't defined we don't need to hide it but we still
753
755
  // want to make the next window the new current window.
754
756
  let closeWindowPromise;
755
757
  if (this.currentWindow) {
756
- // TODO: Kind of a hack, could use win.on('show') event to trigger hide?
757
- // Would only work in electron environment so need to do in BrowserWindowRenderer.
758
- // Should show be async then?
759
- // Or try paintWhenInitiallyHidden: false?
760
758
  if (this.options.closeWindowDelayMs !== undefined) {
761
759
  // Don't await here because this will cause a slight delay when playing the next window.
762
760
  // Instead we want to wait for window close at the end of this method.
763
761
  closeWindowPromise = new Promise((resolve) => {
762
+ // Capture the current window reference to close because this.currentWindow will be
763
+ // set to the next window before the timeout fires.
764
+ const windowToClose = this.currentWindow;
764
765
  setTimeout(async () => {
765
- if (this.currentWindow) {
766
- this.currentWindow.hide();
767
- await this.removeCurrentWindow();
766
+ if (windowToClose) {
767
+ // TODO: Do we need to check if the window is already removed/destroyed?
768
+ // TODO: Add a guard in BrowserWindowRenderer.removeWindow to check if the window is destroyed?
769
+ await windowToClose.remove();
770
+ // TODO: We can't use this.removeCurrentWindow because the currentWindow reference has already
771
+ // changed by the time the timeout fires. Is there a better way to handle this?
772
+ // await this.removeCurrentWindow();
768
773
  }
769
774
  resolve(undefined);
770
775
  }, this.options.closeWindowDelayMs);