@raydiant/playlist-window-manager 0.27.3-rc.2 → 0.28.0
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/build/BrowserViewRenderer.d.ts +1 -0
- package/build/BrowserViewRenderer.js +7 -0
- package/build/BrowserWindowRenderer.js +2 -2
- package/build/PresentationWindow.js +4 -2
- package/build/preload.js +2 -0
- package/package.json +1 -1
- package/src/BrowserViewRenderer.ts +11 -0
- package/src/BrowserWindowRenderer.ts +2 -2
- package/src/PresentationWindow.ts +4 -2
- package/src/preload.ts +2 -0
|
@@ -13,6 +13,7 @@ export default class BrowserViewRenderer implements PresentationWindowRenderer {
|
|
|
13
13
|
removeWindow(windowId: string): Promise<void>;
|
|
14
14
|
sendMessageString(windowId: string, message: string): void;
|
|
15
15
|
sendMessageObject(windowId: string, type: string, payload?: any): void;
|
|
16
|
+
sendOnlineStatus(windowId: string, isOnline: boolean): void;
|
|
16
17
|
muteWindow(windowId: string): void;
|
|
17
18
|
unMuteWindow(windowId: string): void;
|
|
18
19
|
private getWindow;
|
|
@@ -191,6 +191,13 @@ var BrowserViewRenderer = /** @class */ (function () {
|
|
|
191
191
|
}
|
|
192
192
|
window.view.webContents.send('electron-main', { type: type, payload: payload });
|
|
193
193
|
};
|
|
194
|
+
BrowserViewRenderer.prototype.sendOnlineStatus = function (windowId, isOnline) {
|
|
195
|
+
var window = this.getWindow(windowId);
|
|
196
|
+
if (!window) {
|
|
197
|
+
throw new Error("Failed to send isOnline status to window, missing window id '".concat(windowId, "'"));
|
|
198
|
+
}
|
|
199
|
+
window.view.webContents.send('online-status', isOnline);
|
|
200
|
+
};
|
|
194
201
|
BrowserViewRenderer.prototype.muteWindow = function (windowId) {
|
|
195
202
|
var window = this.getWindow(windowId);
|
|
196
203
|
if (!window) {
|
|
@@ -90,7 +90,7 @@ var BrowserWindowRenderer = /** @class */ (function () {
|
|
|
90
90
|
* This option fixes window not being able to take fullscreen leaving
|
|
91
91
|
* 1px gap at the right and bottom of the screen.
|
|
92
92
|
*/
|
|
93
|
-
|
|
93
|
+
resizable: false,
|
|
94
94
|
frame: this.opts.frame,
|
|
95
95
|
hasShadow: this.opts.hasShadow,
|
|
96
96
|
webPreferences: {
|
|
@@ -133,7 +133,7 @@ var BrowserWindowRenderer = /** @class */ (function () {
|
|
|
133
133
|
* This option fixes window not being able to take fullscreen leaving
|
|
134
134
|
* 1px gap at the right and bottom of the screen.
|
|
135
135
|
*/
|
|
136
|
-
|
|
136
|
+
resizable: false,
|
|
137
137
|
frame: this.opts.frame,
|
|
138
138
|
// NOTE: useWindowPool: true does not work with renderChildWindowsAsBrowserViews: false
|
|
139
139
|
// because the parent can't be changed after creating the BrowserWindow.
|
|
@@ -757,11 +757,13 @@ var PresentationWindow = /** @class */ (function () {
|
|
|
757
757
|
};
|
|
758
758
|
PresentationWindow.prototype.sendOnlineStatus = function (isOnline) {
|
|
759
759
|
var _a = this.options, windowId = _a.windowId, renderer = _a.renderer;
|
|
760
|
-
// Send online-status event.
|
|
761
|
-
// are bypassing Raydiant SDK message receivers
|
|
760
|
+
// Send online-status event. We are not using sendMessageObject since we
|
|
761
|
+
// are bypassing Raydiant SDK's message receivers and communicating directly
|
|
762
|
+
// with the preload script.
|
|
762
763
|
if (renderer.sendOnlineStatus) {
|
|
763
764
|
renderer.sendOnlineStatus(windowId, isOnline);
|
|
764
765
|
}
|
|
766
|
+
// Forward the event to the child window managers.
|
|
765
767
|
Object.values(this.windowManagers).forEach(function (wm) {
|
|
766
768
|
wm.sendOnlineStatus(isOnline);
|
|
767
769
|
});
|
package/build/preload.js
CHANGED
|
@@ -59,6 +59,7 @@ Object.defineProperty(navigator, 'onLine', {
|
|
|
59
59
|
});
|
|
60
60
|
var offlineListeners = new Set();
|
|
61
61
|
var onlineListeners = new Set();
|
|
62
|
+
// Intercept online/offline add event listeners so we can call them when online status changes.
|
|
62
63
|
var originalAddEventListener = window.addEventListener.bind(window);
|
|
63
64
|
Object.defineProperty(window, 'addEventListener', {
|
|
64
65
|
value: function (type, listener) {
|
|
@@ -73,6 +74,7 @@ Object.defineProperty(window, 'addEventListener', {
|
|
|
73
74
|
}
|
|
74
75
|
},
|
|
75
76
|
});
|
|
77
|
+
// Intercept online/offline remove event listeners so we can remove our custom listeners.
|
|
76
78
|
var originalRemoveEventListener = window.removeEventListener.bind(window);
|
|
77
79
|
Object.defineProperty(window, 'removeEventListener', {
|
|
78
80
|
value: function (type, listener) {
|
package/package.json
CHANGED
|
@@ -154,6 +154,17 @@ export default class BrowserViewRenderer implements PresentationWindowRenderer {
|
|
|
154
154
|
window.view.webContents.send('electron-main', { type, payload });
|
|
155
155
|
}
|
|
156
156
|
|
|
157
|
+
public sendOnlineStatus(windowId: string, isOnline: boolean) {
|
|
158
|
+
const window = this.getWindow(windowId);
|
|
159
|
+
if (!window) {
|
|
160
|
+
throw new Error(
|
|
161
|
+
`Failed to send isOnline status to window, missing window id '${windowId}'`
|
|
162
|
+
);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
window.view.webContents.send('online-status', isOnline);
|
|
166
|
+
}
|
|
167
|
+
|
|
157
168
|
public muteWindow(windowId: string) {
|
|
158
169
|
const window = this.getWindow(windowId);
|
|
159
170
|
if (!window) {
|
|
@@ -67,7 +67,7 @@ export default class BrowserWindowRenderer
|
|
|
67
67
|
* This option fixes window not being able to take fullscreen leaving
|
|
68
68
|
* 1px gap at the right and bottom of the screen.
|
|
69
69
|
*/
|
|
70
|
-
|
|
70
|
+
resizable: false,
|
|
71
71
|
frame: this.opts.frame,
|
|
72
72
|
hasShadow: this.opts.hasShadow,
|
|
73
73
|
webPreferences: {
|
|
@@ -119,7 +119,7 @@ export default class BrowserWindowRenderer
|
|
|
119
119
|
* This option fixes window not being able to take fullscreen leaving
|
|
120
120
|
* 1px gap at the right and bottom of the screen.
|
|
121
121
|
*/
|
|
122
|
-
|
|
122
|
+
resizable: false,
|
|
123
123
|
frame: this.opts.frame,
|
|
124
124
|
// NOTE: useWindowPool: true does not work with renderChildWindowsAsBrowserViews: false
|
|
125
125
|
// because the parent can't be changed after creating the BrowserWindow.
|
|
@@ -528,13 +528,15 @@ export default class PresentationWindow {
|
|
|
528
528
|
|
|
529
529
|
public sendOnlineStatus(isOnline: boolean) {
|
|
530
530
|
const { windowId, renderer } = this.options;
|
|
531
|
-
// Send online-status event. This Separate from sendMessageObject since we
|
|
532
|
-
// are bypassing Raydiant SDK message receivers.
|
|
533
531
|
|
|
532
|
+
// Send online-status event. We are not using sendMessageObject since we
|
|
533
|
+
// are bypassing Raydiant SDK's message receivers and communicating directly
|
|
534
|
+
// with the preload script.
|
|
534
535
|
if (renderer.sendOnlineStatus) {
|
|
535
536
|
renderer.sendOnlineStatus(windowId, isOnline);
|
|
536
537
|
}
|
|
537
538
|
|
|
539
|
+
// Forward the event to the child window managers.
|
|
538
540
|
Object.values(this.windowManagers).forEach((wm) => {
|
|
539
541
|
wm.sendOnlineStatus(isOnline);
|
|
540
542
|
});
|
package/src/preload.ts
CHANGED
|
@@ -79,6 +79,7 @@ Object.defineProperty(navigator, 'onLine', {
|
|
|
79
79
|
const offlineListeners = new Set<EventListenerOrEventListenerObject>();
|
|
80
80
|
const onlineListeners = new Set<EventListenerOrEventListenerObject>();
|
|
81
81
|
|
|
82
|
+
// Intercept online/offline add event listeners so we can call them when online status changes.
|
|
82
83
|
const originalAddEventListener = window.addEventListener.bind(window);
|
|
83
84
|
Object.defineProperty(window, 'addEventListener', {
|
|
84
85
|
value: (type: string, listener: EventListenerOrEventListenerObject) => {
|
|
@@ -92,6 +93,7 @@ Object.defineProperty(window, 'addEventListener', {
|
|
|
92
93
|
},
|
|
93
94
|
});
|
|
94
95
|
|
|
96
|
+
// Intercept online/offline remove event listeners so we can remove our custom listeners.
|
|
95
97
|
const originalRemoveEventListener = window.removeEventListener.bind(window);
|
|
96
98
|
Object.defineProperty(window, 'removeEventListener', {
|
|
97
99
|
value: (type: string, listener: EventListenerOrEventListenerObject) => {
|