@raydiant/playlist-window-manager 0.28.1 → 0.28.2-rc2
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,6 +128,7 @@ var BrowserWindowRenderer = /** @class */ (function () {
|
|
|
128
128
|
},
|
|
129
129
|
})
|
|
130
130
|
: this.createOrGetPooledBrowserWindow(windowId, {
|
|
131
|
+
paintWhenInitiallyHidden: false,
|
|
131
132
|
show: false,
|
|
132
133
|
/**
|
|
133
134
|
* This option fixes window not being able to take fullscreen leaving
|
|
@@ -17,6 +17,7 @@ export interface PlaylistWindowManagerOptions {
|
|
|
17
17
|
parentWindowId?: string;
|
|
18
18
|
windowName?: string;
|
|
19
19
|
isPreview?: boolean;
|
|
20
|
+
closeWindowDelayMs?: number;
|
|
20
21
|
onEnableInterruptLock?: () => void;
|
|
21
22
|
onDisableInterruptLock?: () => void;
|
|
22
23
|
getTerminal?: () => Terminal | null;
|
|
@@ -74,6 +74,7 @@ var WindowLoadError_1 = __importDefault(require("./WindowLoadError"));
|
|
|
74
74
|
// Wait at least 3 seconds before restarting or moving onto the next window
|
|
75
75
|
// to prevent log spam causing devices to become unresponsive.
|
|
76
76
|
var minTimeBetweenCompletes = 3000;
|
|
77
|
+
var delay = function (ms) { return new Promise(function (res) { return setTimeout(res, ms); }); };
|
|
77
78
|
var PlaylistWindowManager = /** @class */ (function (_super) {
|
|
78
79
|
__extends(PlaylistWindowManager, _super);
|
|
79
80
|
function PlaylistWindowManager(options) {
|
|
@@ -123,7 +124,7 @@ var PlaylistWindowManager = /** @class */ (function (_super) {
|
|
|
123
124
|
_this.emitCurrentWindowEvent('window_charge_request', request);
|
|
124
125
|
};
|
|
125
126
|
_this.handleCurrentPresentationComplete = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
126
|
-
var logger, isThrottled, now, timeSinceLastComplete,
|
|
127
|
+
var logger, isThrottled, now, timeSinceLastComplete, delay_1, _a, next, preview, nextPreviewPresentationId;
|
|
127
128
|
var _this = this;
|
|
128
129
|
return __generator(this, function (_b) {
|
|
129
130
|
switch (_b.label) {
|
|
@@ -137,12 +138,12 @@ var PlaylistWindowManager = /** @class */ (function (_super) {
|
|
|
137
138
|
isThrottled = true;
|
|
138
139
|
// Throttle presentation complete handler if we have not throttled already.
|
|
139
140
|
if (this.currentPresentationCompleteTimeout === null) {
|
|
140
|
-
|
|
141
|
-
logger.warn("Throttling presentation complete handler for ".concat(
|
|
141
|
+
delay_1 = minTimeBetweenCompletes - timeSinceLastComplete + 1;
|
|
142
|
+
logger.warn("Throttling presentation complete handler for ".concat(delay_1, "ms because it was called again in less than ").concat(minTimeBetweenCompletes, "ms"));
|
|
142
143
|
this.currentPresentationCompleteTimeout = setTimeout(function () {
|
|
143
144
|
_this.currentPresentationCompleteTimeout = null;
|
|
144
145
|
_this.handleCurrentPresentationComplete();
|
|
145
|
-
},
|
|
146
|
+
}, delay_1);
|
|
146
147
|
}
|
|
147
148
|
else {
|
|
148
149
|
logger.warn("Skipping presentation complete because it is currently throttled");
|
|
@@ -940,13 +941,19 @@ var PlaylistWindowManager = /** @class */ (function (_super) {
|
|
|
940
941
|
if (this.nextWindow) {
|
|
941
942
|
this.nextWindow.show(this.isFocused);
|
|
942
943
|
}
|
|
943
|
-
if (!this.currentWindow) return [3 /*break*/,
|
|
944
|
-
this.
|
|
945
|
-
return [4 /*yield*/, this.
|
|
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)];
|
|
946
947
|
case 1:
|
|
947
948
|
_a.sent();
|
|
948
949
|
_a.label = 2;
|
|
949
950
|
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:
|
|
950
957
|
// Swap windows.
|
|
951
958
|
this.currentWindow = this.nextWindow;
|
|
952
959
|
if (this.currentWindow) {
|
package/package.json
CHANGED
|
@@ -70,6 +70,8 @@ export interface PlaylistWindowManagerOptions {
|
|
|
70
70
|
// Set to true to render the presentation window as a preview.
|
|
71
71
|
isPreview?: boolean;
|
|
72
72
|
|
|
73
|
+
closeWindowDelayMs?: number;
|
|
74
|
+
|
|
73
75
|
// Called when the current window wants to enable the interrupt lock
|
|
74
76
|
onEnableInterruptLock?: () => void;
|
|
75
77
|
|
|
@@ -87,6 +89,8 @@ export interface PlaylistWindowManagerOptions {
|
|
|
87
89
|
// to prevent log spam causing devices to become unresponsive.
|
|
88
90
|
const minTimeBetweenCompletes = 3000;
|
|
89
91
|
|
|
92
|
+
const delay = (ms: number) => new Promise((res) => setTimeout(res, ms));
|
|
93
|
+
|
|
90
94
|
interface EvalRuleEngineResult {
|
|
91
95
|
next: RE.NextPresentationID;
|
|
92
96
|
preview: RE.NextPresentationID;
|
|
@@ -750,6 +754,13 @@ export default class PlaylistWindowManager extends EventEmitter {
|
|
|
750
754
|
// If current window isn't defined we don't need to hide it but we still
|
|
751
755
|
// want to make the next window the new current window.
|
|
752
756
|
if (this.currentWindow) {
|
|
757
|
+
// TODO: Kind of a hack, could use win.on('show') event to trigger hide?
|
|
758
|
+
// Would only work in electron environment so need to do in BrowserWindowRenderer.
|
|
759
|
+
// Should show be async then?
|
|
760
|
+
// Or try paintWhenInitiallyHidden: false?
|
|
761
|
+
if (this.options.closeWindowDelayMs !== undefined) {
|
|
762
|
+
await delay(this.options.closeWindowDelayMs);
|
|
763
|
+
}
|
|
753
764
|
this.currentWindow.hide();
|
|
754
765
|
await this.removeCurrentWindow();
|
|
755
766
|
}
|