@raydiant/playlist-window-manager 0.20.0 → 0.22.0-rc-electron-upgrade

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.
@@ -5,13 +5,14 @@ export default class BrowserViewRenderer implements PresentationWindowRenderer {
5
5
  private offscreenWindow;
6
6
  private windows;
7
7
  constructor(mainWindow: BrowserWindow, offscreenWindow: BrowserWindow);
8
- createWindow({ windowId, parentWindowId, bounds, backgroundColor, receiveMessageCallback }: CreateWindowOptions): Promise<void>;
8
+ createWindow({ windowId, parentWindowId, bounds, backgroundColor, receiveMessageCallback, }: CreateWindowOptions): Promise<void>;
9
9
  loadWindow(windowId: string, url: string): Promise<void>;
10
10
  updateWindowBounds(windowId: string, bounds: WindowBounds): void;
11
11
  showWindow(windowId: string, isFocused: boolean): void;
12
12
  hideWindow(windowId: string): void;
13
13
  removeWindow(windowId: string): Promise<void>;
14
- sendMessage(windowId: string, message: string): void;
14
+ sendMessageString(windowId: string, message: string): void;
15
+ sendMessageObject(windowId: string, type: string, payload?: any): void;
15
16
  muteWindow(windowId: string): void;
16
17
  unMuteWindow(windowId: string): void;
17
18
  private getWindow;
@@ -10,11 +10,35 @@ var __assign = (this && this.__assign) || function () {
10
10
  };
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || function (mod) {
30
+ if (mod && mod.__esModule) return mod;
31
+ var result = {};
32
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
+ __setModuleDefault(result, mod);
34
+ return result;
35
+ };
13
36
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
37
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
38
  return new (P || (P = Promise))(function (resolve, reject) {
15
39
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
40
  function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
- function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
41
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
42
  step((generator = generator.apply(thisArg, _arguments || [])).next());
19
43
  });
20
44
  };
@@ -24,7 +48,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
24
48
  function verb(n) { return function (v) { return step([n, v]); }; }
25
49
  function step(op) {
26
50
  if (f) throw new TypeError("Generator is already executing.");
27
- while (_) try {
51
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
28
52
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
53
  if (y = 0, t) op = [op[0] & 2, t.value];
30
54
  switch (op[0]) {
@@ -45,13 +69,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
45
69
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
70
  }
47
71
  };
48
- var __importStar = (this && this.__importStar) || function (mod) {
49
- if (mod && mod.__esModule) return mod;
50
- var result = {};
51
- if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
52
- result["default"] = mod;
53
- return result;
54
- };
55
72
  Object.defineProperty(exports, "__esModule", { value: true });
56
73
  var path = __importStar(require("path"));
57
74
  var electron_1 = require("electron");
@@ -69,15 +86,15 @@ var BrowserViewRenderer = /** @class */ (function () {
69
86
  window = {
70
87
  view: new electron_1.BrowserView({
71
88
  webPreferences: {
72
- preload: path.join(__dirname, 'preload.js')
73
- }
89
+ preload: path.join(__dirname, 'preload.js'),
90
+ },
74
91
  }),
75
- bounds: bounds || __assign({}, this.mainWindow.getBounds(), { x: 0, y: 0 }),
92
+ bounds: bounds || __assign(__assign({}, this.mainWindow.getBounds()), { x: 0, y: 0 }),
76
93
  receiveMessageCallback: function (_, type, payload) {
77
94
  if (receiveMessageCallback) {
78
95
  receiveMessageCallback(type, payload);
79
96
  }
80
- }
97
+ },
81
98
  };
82
99
  this.windows[windowId] = window;
83
100
  electron_1.ipcMain.on(windowId, window.receiveMessageCallback);
@@ -91,7 +108,7 @@ var BrowserViewRenderer = /** @class */ (function () {
91
108
  if (!parentWindowId) {
92
109
  window.view.setAutoResize({
93
110
  width: true,
94
- height: true
111
+ height: true,
95
112
  });
96
113
  }
97
114
  return [2 /*return*/];
@@ -106,7 +123,7 @@ var BrowserViewRenderer = /** @class */ (function () {
106
123
  case 0:
107
124
  window = this.getWindow(windowId);
108
125
  if (!window) {
109
- throw new Error("Failed to load window, missing window id '" + windowId + "'");
126
+ throw new Error("Failed to load window, missing window id '".concat(windowId, "'"));
110
127
  }
111
128
  return [4 /*yield*/, window.view.webContents.loadURL(url)];
112
129
  case 1:
@@ -119,7 +136,7 @@ var BrowserViewRenderer = /** @class */ (function () {
119
136
  BrowserViewRenderer.prototype.updateWindowBounds = function (windowId, bounds) {
120
137
  var window = this.getWindow(windowId);
121
138
  if (!window) {
122
- throw new Error("Failed to update window bounds, missing window id '" + windowId + "'");
139
+ throw new Error("Failed to update window bounds, missing window id '".concat(windowId, "'"));
123
140
  }
124
141
  window.bounds = bounds;
125
142
  window.view.setBounds(window.bounds);
@@ -127,7 +144,7 @@ var BrowserViewRenderer = /** @class */ (function () {
127
144
  BrowserViewRenderer.prototype.showWindow = function (windowId, isFocused) {
128
145
  var window = this.getWindow(windowId);
129
146
  if (!window) {
130
- throw new Error("Failed to show window, missing window id '" + windowId + "'");
147
+ throw new Error("Failed to show window, missing window id '".concat(windowId, "'"));
131
148
  }
132
149
  this.mainWindow.addBrowserView(window.view);
133
150
  if (isFocused) {
@@ -139,7 +156,7 @@ var BrowserViewRenderer = /** @class */ (function () {
139
156
  BrowserViewRenderer.prototype.hideWindow = function (windowId) {
140
157
  var window = this.getWindow(windowId);
141
158
  if (!window) {
142
- throw new Error("Failed to hide window, missing window id '" + windowId + "'");
159
+ throw new Error("Failed to hide window, missing window id '".concat(windowId, "'"));
143
160
  }
144
161
  this.offscreenWindow.addBrowserView(window.view);
145
162
  };
@@ -149,7 +166,7 @@ var BrowserViewRenderer = /** @class */ (function () {
149
166
  return __generator(this, function (_a) {
150
167
  window = this.getWindow(windowId);
151
168
  if (!window) {
152
- throw new Error("Failed to hide window, missing window id '" + windowId + "'");
169
+ throw new Error("Failed to hide window, missing window id '".concat(windowId, "'"));
153
170
  }
154
171
  this.hideWindow(windowId);
155
172
  window.view.webContents.loadURL('about:blank');
@@ -159,24 +176,31 @@ var BrowserViewRenderer = /** @class */ (function () {
159
176
  });
160
177
  });
161
178
  };
162
- BrowserViewRenderer.prototype.sendMessage = function (windowId, message) {
179
+ BrowserViewRenderer.prototype.sendMessageString = function (windowId, message) {
163
180
  var window = this.getWindow(windowId);
164
181
  if (!window) {
165
- throw new Error("Failed to send message to window, missing window id '" + windowId + "'");
182
+ throw new Error("Failed to send message to window, missing window id '".concat(windowId, "'"));
166
183
  }
167
184
  window.view.webContents.send('electron-main', message);
168
185
  };
186
+ BrowserViewRenderer.prototype.sendMessageObject = function (windowId, type, payload) {
187
+ var window = this.getWindow(windowId);
188
+ if (!window) {
189
+ throw new Error("Failed to send message to window, missing window id '".concat(windowId, "'"));
190
+ }
191
+ window.view.webContents.send('electron-main', { type: type, payload: payload });
192
+ };
169
193
  BrowserViewRenderer.prototype.muteWindow = function (windowId) {
170
194
  var window = this.getWindow(windowId);
171
195
  if (!window) {
172
- throw new Error("Failed to mute window, missing window id '" + windowId + "'");
196
+ throw new Error("Failed to mute window, missing window id '".concat(windowId, "'"));
173
197
  }
174
198
  window.view.webContents.setAudioMuted(true);
175
199
  };
176
200
  BrowserViewRenderer.prototype.unMuteWindow = function (windowId) {
177
201
  var window = this.getWindow(windowId);
178
202
  if (!window) {
179
- throw new Error("Failed to unmute window, missing window id '" + windowId + "'");
203
+ throw new Error("Failed to unmute window, missing window id '".concat(windowId, "'"));
180
204
  }
181
205
  window.view.webContents.setAudioMuted(false);
182
206
  };
@@ -23,13 +23,14 @@ export default class BrowserWindowRenderer implements PresentationWindowRenderer
23
23
  private proxySettings;
24
24
  private logger;
25
25
  constructor(opts: BrowserWindowRendererOptions);
26
- createWindow({ windowId, parentWindowId, bounds, backgroundColor, receiveMessageCallback, errorCallback }: CreateWindowOptions): Promise<void>;
26
+ createWindow({ windowId, parentWindowId, bounds, backgroundColor, receiveMessageCallback, errorCallback, }: CreateWindowOptions): Promise<void>;
27
27
  loadWindow(windowId: string, url: string): Promise<void>;
28
28
  updateWindowBounds(windowId: string, bounds: WindowBounds): void;
29
29
  showWindow(windowId: string, isFocused: boolean): void;
30
30
  hideWindow(windowId: string): void;
31
31
  removeWindow(windowId: string): Promise<void>;
32
- sendMessage(windowId: string, message: string): void;
32
+ sendMessageString(windowId: string, message: string): void;
33
+ sendMessageObject(windowId: string, type: string, payload?: any): void;
33
34
  muteWindow(windowId: string): void;
34
35
  unMuteWindow(windowId: string): void;
35
36
  private getWindow;
@@ -10,11 +10,35 @@ var __assign = (this && this.__assign) || function () {
10
10
  };
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || function (mod) {
30
+ if (mod && mod.__esModule) return mod;
31
+ var result = {};
32
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
+ __setModuleDefault(result, mod);
34
+ return result;
35
+ };
13
36
  var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
37
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
14
38
  return new (P || (P = Promise))(function (resolve, reject) {
15
39
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
16
40
  function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
17
- function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
41
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
18
42
  step((generator = generator.apply(thisArg, _arguments || [])).next());
19
43
  });
20
44
  };
@@ -24,7 +48,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
24
48
  function verb(n) { return function (v) { return step([n, v]); }; }
25
49
  function step(op) {
26
50
  if (f) throw new TypeError("Generator is already executing.");
27
- while (_) try {
51
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
28
52
  if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
29
53
  if (y = 0, t) op = [op[0] & 2, t.value];
30
54
  switch (op[0]) {
@@ -45,13 +69,6 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
45
69
  if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
46
70
  }
47
71
  };
48
- var __importStar = (this && this.__importStar) || function (mod) {
49
- if (mod && mod.__esModule) return mod;
50
- var result = {};
51
- if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
52
- result["default"] = mod;
53
- return result;
54
- };
55
72
  var __importDefault = (this && this.__importDefault) || function (mod) {
56
73
  return (mod && mod.__esModule) ? mod : { "default": mod };
57
74
  };
@@ -72,8 +89,8 @@ var BrowserWindowRenderer = /** @class */ (function () {
72
89
  frame: this.opts.frame,
73
90
  hasShadow: this.opts.hasShadow,
74
91
  webPreferences: {
75
- preload: path.join(__dirname, 'preload.js')
76
- }
92
+ preload: path.join(__dirname, 'preload.js'),
93
+ },
77
94
  });
78
95
  this.proxySettings = null;
79
96
  this.offscreenWindow.setBounds(opts.bounds);
@@ -100,8 +117,8 @@ var BrowserWindowRenderer = /** @class */ (function () {
100
117
  view: parentWindowId && this.opts.renderChildWindowsAsBrowserViews
101
118
  ? this.createOrGetPooledBrowserView(windowId, {
102
119
  webPreferences: {
103
- preload: path.join(__dirname, 'preload.js')
104
- }
120
+ preload: path.join(__dirname, 'preload.js'),
121
+ },
105
122
  })
106
123
  : this.createOrGetPooledBrowserWindow(windowId, {
107
124
  show: false,
@@ -114,15 +131,15 @@ var BrowserWindowRenderer = /** @class */ (function () {
114
131
  transparent: backgroundColor === 'transparent',
115
132
  hasShadow: this.opts.hasShadow,
116
133
  webPreferences: {
117
- preload: path.join(__dirname, 'preload.js')
118
- }
134
+ preload: path.join(__dirname, 'preload.js'),
135
+ },
119
136
  }),
120
137
  // If we are creating a child window and renderChildWindowsAsBrowserViews is false that means
121
138
  // we are rendering child windows with BrowserWindow. BrowserWindows are positioned absolutely so
122
139
  // to place them in the correct spot relative to their parent we need to add the main window's x / y.
123
140
  // BrowserViews are relatively positioned so we don't need to do that.
124
141
  bounds: parentWindowId && !this.opts.renderChildWindowsAsBrowserViews
125
- ? __assign({}, bounds, { x: bounds.x + this.opts.bounds.x, y: bounds.y + this.opts.bounds.y }) : bounds,
142
+ ? __assign(__assign({}, bounds), { x: bounds.x + this.opts.bounds.x, y: bounds.y + this.opts.bounds.y }) : bounds,
126
143
  receiveMessageCallback: function (_, type, payload) {
127
144
  if (receiveMessageCallback) {
128
145
  receiveMessageCallback(type, payload);
@@ -131,18 +148,21 @@ var BrowserWindowRenderer = /** @class */ (function () {
131
148
  unresponsiveCallback: function () {
132
149
  _this.logger.error("Window received 'unresponsive' event", { windowId: windowId });
133
150
  _this.windowCrashHandler('unresponsive');
134
- errorCallback(new WindowUnresponsiveError_1.default("Window '" + windowId + "' is unresponsive"));
151
+ errorCallback(new WindowUnresponsiveError_1.default("Window '".concat(windowId, "' is unresponsive")));
135
152
  },
136
153
  renderProcessGoneCallback: function (_, details) {
137
- _this.logger.error("Window received 'render-process-gone' event. Reason: " + details.reason, { windowId: windowId });
154
+ _this.logger.error("Window received 'render-process-gone' event. Reason: ".concat(details.reason), { windowId: windowId });
138
155
  // TODO: Handle different reasons for render-process-gone?
139
156
  // https://www.electronjs.org/docs/api/web-contents#event-render-process-gone
140
157
  _this.windowCrashHandler('render-process-gone');
141
- errorCallback(new WindowUnresponsiveError_1.default("Window '" + windowId + "' render process gone"));
142
- }
158
+ errorCallback(new WindowUnresponsiveError_1.default("Window '".concat(windowId, "' render process gone")));
159
+ },
143
160
  };
144
161
  // Attached crash handlers to skip presentation on error.
145
- window.view.webContents.on('render-process-gone', window.renderProcessGoneCallback);
162
+ // window.view.webContents.on(
163
+ // 'render-process-gone',
164
+ // window.renderProcessGoneCallback
165
+ // );
146
166
  window.view.webContents.on('unresponsive', window.unresponsiveCallback);
147
167
  if (window.view instanceof electron_1.BrowserView) {
148
168
  this.moveWindowOffscreen(window);
@@ -178,7 +198,7 @@ var BrowserWindowRenderer = /** @class */ (function () {
178
198
  case 0:
179
199
  window = this.getWindow(windowId);
180
200
  if (!window) {
181
- throw new Error("Failed to load window, missing window id '" + windowId + "'");
201
+ throw new Error("Failed to load window, missing window id '".concat(windowId, "'"));
182
202
  }
183
203
  return [4 /*yield*/, window.view.webContents.loadURL(url)];
184
204
  case 1:
@@ -191,13 +211,13 @@ var BrowserWindowRenderer = /** @class */ (function () {
191
211
  BrowserWindowRenderer.prototype.updateWindowBounds = function (windowId, bounds) {
192
212
  var window = this.getWindow(windowId);
193
213
  if (!window) {
194
- throw new Error("Failed to update window bounds, missing window id '" + windowId + "'");
214
+ throw new Error("Failed to update window bounds, missing window id '".concat(windowId, "'"));
195
215
  }
196
216
  window.bounds = bounds;
197
217
  if (window.view instanceof electron_1.BrowserWindow && window.parentWindowId) {
198
218
  // Child BrowserWindows are absolutely positioned so we need to add the main windows
199
219
  // x/y to when updating the child window's bounds.
200
- window.view.setBounds(__assign({}, window.bounds, { x: window.bounds.x + this.opts.bounds.x, y: window.bounds.y + this.opts.bounds.y }));
220
+ window.view.setBounds(__assign(__assign({}, window.bounds), { x: window.bounds.x + this.opts.bounds.x, y: window.bounds.y + this.opts.bounds.y }));
201
221
  }
202
222
  else {
203
223
  window.view.setBounds(window.bounds);
@@ -206,7 +226,7 @@ var BrowserWindowRenderer = /** @class */ (function () {
206
226
  BrowserWindowRenderer.prototype.showWindow = function (windowId, isFocused) {
207
227
  var window = this.getWindow(windowId);
208
228
  if (!window) {
209
- throw new Error("Failed to show window, missing window id '" + windowId + "'");
229
+ throw new Error("Failed to show window, missing window id '".concat(windowId, "'"));
210
230
  }
211
231
  if (window.view instanceof electron_1.BrowserWindow) {
212
232
  if (isFocused) {
@@ -228,7 +248,7 @@ var BrowserWindowRenderer = /** @class */ (function () {
228
248
  BrowserWindowRenderer.prototype.hideWindow = function (windowId) {
229
249
  var window = this.getWindow(windowId);
230
250
  if (!window) {
231
- throw new Error("Failed to hide window, missing window id '" + windowId + "'");
251
+ throw new Error("Failed to hide window, missing window id '".concat(windowId, "'"));
232
252
  }
233
253
  if (window.view instanceof electron_1.BrowserWindow) {
234
254
  window.view.hide();
@@ -245,10 +265,13 @@ var BrowserWindowRenderer = /** @class */ (function () {
245
265
  case 0:
246
266
  window = this.getWindow(windowId);
247
267
  if (!window) {
248
- throw new Error("Failed to remove window, missing window id '" + windowId + "'");
268
+ throw new Error("Failed to remove window, missing window id '".concat(windowId, "'"));
249
269
  }
250
270
  // Remove crash handlers
251
- window.view.webContents.removeListener('render-process-gone', window.renderProcessGoneCallback);
271
+ // window.view.webContents.removeListener(
272
+ // 'render-process-gone',
273
+ // window.renderProcessGoneCallback
274
+ // );
252
275
  window.view.webContents.removeListener('unresponsive', window.unresponsiveCallback);
253
276
  // Remove message handler
254
277
  electron_1.ipcMain.removeListener(windowId, window.receiveMessageCallback);
@@ -276,24 +299,31 @@ var BrowserWindowRenderer = /** @class */ (function () {
276
299
  });
277
300
  });
278
301
  };
279
- BrowserWindowRenderer.prototype.sendMessage = function (windowId, message) {
302
+ BrowserWindowRenderer.prototype.sendMessageString = function (windowId, message) {
280
303
  var window = this.getWindow(windowId);
281
304
  if (!window) {
282
- throw new Error("Failed to send message to window, missing window id '" + windowId + "'");
305
+ throw new Error("Failed to send message to window, missing window id '".concat(windowId, "'"));
283
306
  }
284
307
  window.view.webContents.send('electron-main', message);
285
308
  };
309
+ BrowserWindowRenderer.prototype.sendMessageObject = function (windowId, type, payload) {
310
+ var window = this.getWindow(windowId);
311
+ if (!window) {
312
+ throw new Error("Failed to send message to window, missing window id '".concat(windowId, "'"));
313
+ }
314
+ window.view.webContents.send('electron-main', { type: type, payload: payload });
315
+ };
286
316
  BrowserWindowRenderer.prototype.muteWindow = function (windowId) {
287
317
  var window = this.getWindow(windowId);
288
318
  if (!window) {
289
- throw new Error("Failed to mute window, missing window id '" + windowId + "'");
319
+ throw new Error("Failed to mute window, missing window id '".concat(windowId, "'"));
290
320
  }
291
321
  window.view.webContents.setAudioMuted(true);
292
322
  };
293
323
  BrowserWindowRenderer.prototype.unMuteWindow = function (windowId) {
294
324
  var window = this.getWindow(windowId);
295
325
  if (!window) {
296
- throw new Error("Failed to unmute window, missing window id '" + windowId + "'");
326
+ throw new Error("Failed to unmute window, missing window id '".concat(windowId, "'"));
297
327
  }
298
328
  window.view.webContents.setAudioMuted(false);
299
329
  };
@@ -312,7 +342,7 @@ var BrowserWindowRenderer = /** @class */ (function () {
312
342
  BrowserWindowRenderer.prototype.addWindowToParent = function (parentWindowId, window) {
313
343
  var parentWindow = this.getWindow(parentWindowId);
314
344
  if (!parentWindow) {
315
- throw new Error("Failed to add window to parent, missing parent window id '" + parentWindowId + "'");
345
+ throw new Error("Failed to add window to parent, missing parent window id '".concat(parentWindowId, "'"));
316
346
  }
317
347
  if (parentWindow.view instanceof electron_1.BrowserWindow) {
318
348
  if (window.view instanceof electron_1.BrowserView) {
@@ -320,34 +350,34 @@ var BrowserWindowRenderer = /** @class */ (function () {
320
350
  parentWindow.view.addBrowserView(window.view);
321
351
  }
322
352
  else {
323
- throw new Error("Failed add window to parent window id '" + parentWindowId + "', child window is not a BrowserView");
353
+ throw new Error("Failed add window to parent window id '".concat(parentWindowId, "', child window is not a BrowserView"));
324
354
  }
325
355
  }
326
356
  else {
327
- throw new Error("Failed add window to parent window id '" + parentWindowId + "', parent window is not a BrowserWindow");
357
+ throw new Error("Failed add window to parent window id '".concat(parentWindowId, "', parent window is not a BrowserWindow"));
328
358
  }
329
359
  };
330
360
  BrowserWindowRenderer.prototype.removeWindowFromParent = function (parentWindowId, window) {
331
361
  var parentWindow = this.getWindow(parentWindowId);
332
362
  if (!parentWindow) {
333
- throw new Error("Failed to remove window from parent, missing parent window id '" + parentWindowId + "'");
363
+ throw new Error("Failed to remove window from parent, missing parent window id '".concat(parentWindowId, "'"));
334
364
  }
335
365
  if (parentWindow.view instanceof electron_1.BrowserWindow) {
336
366
  if (window.view instanceof electron_1.BrowserView) {
337
367
  parentWindow.view.removeBrowserView(window.view);
338
368
  }
339
369
  else {
340
- throw new Error("Failed remove window from parent window id '" + parentWindowId + "', child window is not a BrowserView");
370
+ throw new Error("Failed remove window from parent window id '".concat(parentWindowId, "', child window is not a BrowserView"));
341
371
  }
342
372
  }
343
373
  else {
344
- throw new Error("Failed remove window from parent window id '" + parentWindowId + "', parent window is not a BrowserWindow");
374
+ throw new Error("Failed remove window from parent window id '".concat(parentWindowId, "', parent window is not a BrowserWindow"));
345
375
  }
346
376
  };
347
377
  BrowserWindowRenderer.prototype.getParentBrowserView = function (parentWindowId) {
348
378
  var parentWindow = this.getWindow(parentWindowId);
349
379
  if (!parentWindow) {
350
- throw new Error("Failed to get parent BrowserView, missing parent window id '" + parentWindowId + "'");
380
+ throw new Error("Failed to get parent BrowserView, missing parent window id '".concat(parentWindowId, "'"));
351
381
  }
352
382
  if (!(parentWindow.view instanceof electron_1.BrowserWindow)) {
353
383
  throw new Error("Failed to get parent BrowserView, window is not a BrowserView");
@@ -363,7 +393,7 @@ var BrowserWindowRenderer = /** @class */ (function () {
363
393
  }
364
394
  else {
365
395
  this.logger.info("No free browser windows, adding new window to pool", {
366
- windowId: windowId
396
+ windowId: windowId,
367
397
  });
368
398
  }
369
399
  }
@@ -412,7 +442,7 @@ var BrowserWindowRenderer = /** @class */ (function () {
412
442
  }
413
443
  else {
414
444
  this.logger.info("No free browser views, adding new view to pool", {
415
- windowId: windowId
445
+ windowId: windowId,
416
446
  });
417
447
  }
418
448
  }
@@ -457,8 +487,8 @@ var BrowserWindowRenderer = /** @class */ (function () {
457
487
  BrowserWindowRenderer.prototype.logPoolStats = function () {
458
488
  var bwSize = this.browserWindowPool.size();
459
489
  var bvSize = this.browserViewPool.size();
460
- this.logger.info("BrowserWindow pool total=" + bwSize.total + " inuse=" + bwSize.inuse + " free=" + bwSize.free);
461
- this.logger.info("BrowserView pool total=" + bvSize.total + " inuse=" + bvSize.inuse + " free=" + bvSize.free);
490
+ this.logger.info("BrowserWindow pool total=".concat(bwSize.total, " inuse=").concat(bwSize.inuse, " free=").concat(bwSize.free));
491
+ this.logger.info("BrowserView pool total=".concat(bvSize.total, " inuse=").concat(bvSize.inuse, " free=").concat(bvSize.free));
462
492
  };
463
493
  return BrowserWindowRenderer;
464
494
  }());
@@ -490,7 +520,7 @@ var WindowPool = /** @class */ (function () {
490
520
  return {
491
521
  total: inuse + free,
492
522
  inuse: inuse,
493
- free: free
523
+ free: free,
494
524
  };
495
525
  };
496
526
  return WindowPool;
@@ -3,13 +3,14 @@ export default class IFrameRenderer implements PresentationWindowRenderer {
3
3
  private container;
4
4
  private windows;
5
5
  constructor(container: HTMLElement);
6
- createWindow({ windowId, bounds, backgroundColor, receiveMessageCallback }: CreateWindowOptions): Promise<void>;
6
+ createWindow({ windowId, bounds, backgroundColor, receiveMessageCallback, }: CreateWindowOptions): Promise<void>;
7
7
  loadWindow(windowId: string, url: string): Promise<void>;
8
8
  updateWindowBounds(windowId: string, bounds: WindowBounds): void;
9
9
  showWindow(windowId: string, isFocused: boolean): void;
10
10
  hideWindow(windowId: string): void;
11
11
  removeWindow(windowId: string): Promise<void>;
12
- sendMessage(windowId: string, message: string): void;
12
+ sendMessageString(windowId: string, message: string): void;
13
+ sendMessageObject(windowId: string, type: string, payload?: any): void;
13
14
  muteWindow(windowId: string): void;
14
15
  unMuteWindow(windowId: string): void;
15
16
  destroy(): void;