@raydiant/playlist-window-manager 0.0.0-test-2 → 0.0.0-test-4

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,7 +5,7 @@ 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, logger, 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;
@@ -79,10 +79,11 @@ var BrowserViewRenderer = /** @class */ (function () {
79
79
  this.windows = {};
80
80
  }
81
81
  BrowserViewRenderer.prototype.createWindow = function (_a) {
82
- var windowId = _a.windowId, parentWindowId = _a.parentWindowId, bounds = _a.bounds, backgroundColor = _a.backgroundColor, receiveMessageCallback = _a.receiveMessageCallback;
82
+ var windowId = _a.windowId, parentWindowId = _a.parentWindowId, bounds = _a.bounds, logger = _a.logger, backgroundColor = _a.backgroundColor, receiveMessageCallback = _a.receiveMessageCallback;
83
83
  return __awaiter(this, void 0, void 0, function () {
84
84
  var window;
85
85
  return __generator(this, function (_b) {
86
+ logger.info("playlist-window-manager/src/BrowserViewRenderer.ts createWindow1 ".concat(JSON.stringify(bounds || __assign(__assign({}, this.mainWindow.getBounds()), { x: 0, y: 0 }))));
86
87
  window = {
87
88
  view: new electron_1.BrowserView({
88
89
  webPreferences: {
@@ -99,7 +100,7 @@ var BrowserViewRenderer = /** @class */ (function () {
99
100
  this.windows[windowId] = window;
100
101
  electron_1.ipcMain.on(windowId, window.receiveMessageCallback);
101
102
  this.offscreenWindow.addBrowserView(window.view);
102
- // TODO log bounds
103
+ logger.info("playlist-window-manager/src/BrowserViewRenderer.ts createWindow2 ".concat(JSON.stringify(window.bounds)));
103
104
  window.view.setBounds(window.bounds);
104
105
  if (backgroundColor) {
105
106
  window.view.setBackgroundColor(backgroundColor);
@@ -109,7 +110,7 @@ var BrowserViewRenderer = /** @class */ (function () {
109
110
  if (!parentWindowId) {
110
111
  window.view.setAutoResize({
111
112
  width: true,
112
- height: false,
113
+ height: true,
113
114
  });
114
115
  }
115
116
  return [2 /*return*/];
@@ -93,8 +93,14 @@ var BrowserWindowRenderer = /** @class */ (function () {
93
93
  },
94
94
  });
95
95
  this.proxySettings = null;
96
- // TODO log bounds
96
+ opts.logger.info("playlist-window-manager/src/BrowserWindowRenderer.ts constructor1 ".concat(JSON.stringify(opts.bounds)));
97
97
  this.offscreenWindow.setBounds(opts.bounds);
98
+ opts.logger.info("playlist-window-manager/src/BrowserWindowRenderer.ts constructor2 ".concat(JSON.stringify({
99
+ bounds: this.offscreenWindow.getBounds(),
100
+ normalBounds: this.offscreenWindow.getNormalBounds(),
101
+ contentBounds: this.offscreenWindow.getContentBounds(),
102
+ })));
103
+ this.offscreenWindow.maximize(); // TODO zlv added
98
104
  if (opts.proxySettings) {
99
105
  this.proxySettings = opts.proxySettings;
100
106
  }
@@ -166,6 +172,11 @@ var BrowserWindowRenderer = /** @class */ (function () {
166
172
  window.view.webContents.on('unresponsive', window.unresponsiveCallback);
167
173
  if (window.view instanceof electron_1.BrowserView) {
168
174
  this.moveWindowOffscreen(window);
175
+ this.logger.info("playlist-window-manager/src/BrowserWindowRenderer.ts createWindow2: ".concat(JSON.stringify({
176
+ bounds: this.offscreenWindow.getBounds(),
177
+ normalBounds: this.offscreenWindow.getNormalBounds(),
178
+ contentBounds: this.offscreenWindow.getContentBounds(),
179
+ })));
169
180
  }
170
181
  this.windows[windowId] = window;
171
182
  // Listen for messages from window.
@@ -175,8 +186,9 @@ var BrowserWindowRenderer = /** @class */ (function () {
175
186
  // Electron issue: https://github.com/electron/electron/issues/20357
176
187
  window.view.setBackgroundColor(backgroundColor === 'transparent' ? '#00000000' : backgroundColor);
177
188
  }
178
- this.logger.info("playlist-window-manager/src/BrowserWindowRenderer.ts createWindow2: ".concat(JSON.stringify(window.bounds)));
189
+ this.logger.info("playlist-window-manager/src/BrowserWindowRenderer.ts createWindow3: ".concat(JSON.stringify(window.bounds)));
179
190
  window.view.setBounds(window.bounds);
191
+ this.logger.info("playlist-window-manager/src/BrowserWindowRenderer.ts createWindow4: ".concat(JSON.stringify(window.view.getBounds())));
180
192
  if (!this.proxySettings) return [3 /*break*/, 2];
181
193
  return [4 /*yield*/, window.view.webContents.session.setProxy(this.proxySettings)];
182
194
  case 1:
@@ -657,15 +657,17 @@ var PresentationWindow = /** @class */ (function () {
657
657
  };
658
658
  PresentationWindow.prototype.createAndLoadWindow = function (url, backgroundColor, receiveMessageCallback) {
659
659
  return __awaiter(this, void 0, void 0, function () {
660
- var _a, windowId, parentWindowId, renderer, bounds;
660
+ var _a, windowId, parentWindowId, renderer, bounds, logger;
661
661
  return __generator(this, function (_b) {
662
662
  switch (_b.label) {
663
663
  case 0:
664
- _a = this.options, windowId = _a.windowId, parentWindowId = _a.parentWindowId, renderer = _a.renderer, bounds = _a.bounds;
664
+ _a = this.options, windowId = _a.windowId, parentWindowId = _a.parentWindowId, renderer = _a.renderer, bounds = _a.bounds, logger = _a.logger;
665
+ logger.info("playlist-window-manager/src/PresentationWindow.ts createAndLoadWindow1: ".concat(JSON.stringify(bounds)));
665
666
  renderer.createWindow({
666
667
  windowId: windowId,
667
668
  parentWindowId: parentWindowId,
668
669
  bounds: bounds,
670
+ logger: logger,
669
671
  backgroundColor: backgroundColor,
670
672
  receiveMessageCallback: receiveMessageCallback,
671
673
  errorCallback: this.handleError,
package/build/types.d.ts CHANGED
@@ -82,6 +82,7 @@ export interface CreateWindowOptions {
82
82
  windowId: string;
83
83
  parentWindowId?: string;
84
84
  bounds?: WindowBounds;
85
+ logger: Logger;
85
86
  backgroundColor?: string;
86
87
  receiveMessageCallback?: (type: string, payload?: any) => void;
87
88
  errorCallback: (err: any) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raydiant/playlist-window-manager",
3
- "version": "0.0.0-test-2",
3
+ "version": "0.0.0-test-4",
4
4
  "description": "Window manager for playlist playback.",
5
5
  "main": "build/index.js",
6
6
  "scripts": {
@@ -30,10 +30,15 @@ export default class BrowserViewRenderer implements PresentationWindowRenderer {
30
30
  windowId,
31
31
  parentWindowId,
32
32
  bounds,
33
+ logger,
33
34
  backgroundColor,
34
35
  receiveMessageCallback,
35
36
  }: CreateWindowOptions) {
36
- // TODO log bounds
37
+ logger.info(
38
+ `playlist-window-manager/src/BrowserViewRenderer.ts createWindow1 ${JSON.stringify(
39
+ bounds || { ...this.mainWindow.getBounds(), x: 0, y: 0 }
40
+ )}`
41
+ );
37
42
 
38
43
  const window = {
39
44
  view: new BrowserView({
@@ -60,7 +65,12 @@ export default class BrowserViewRenderer implements PresentationWindowRenderer {
60
65
  ipcMain.on(windowId, window.receiveMessageCallback);
61
66
 
62
67
  this.offscreenWindow.addBrowserView(window.view);
63
- // TODO log bounds
68
+ logger.info(
69
+ `playlist-window-manager/src/BrowserViewRenderer.ts createWindow2 ${JSON.stringify(
70
+ window.bounds
71
+ )}`
72
+ );
73
+
64
74
  window.view.setBounds(window.bounds);
65
75
 
66
76
  if (backgroundColor) {
@@ -72,7 +82,7 @@ export default class BrowserViewRenderer implements PresentationWindowRenderer {
72
82
  if (!parentWindowId) {
73
83
  window.view.setAutoResize({
74
84
  width: true,
75
- height: false,
85
+ height: true,
76
86
  });
77
87
  }
78
88
  }
@@ -72,8 +72,23 @@ export default class BrowserWindowRenderer
72
72
  private logger: Logger;
73
73
 
74
74
  constructor(private opts: BrowserWindowRendererOptions) {
75
- // TODO log bounds
75
+ opts.logger.info(
76
+ `playlist-window-manager/src/BrowserWindowRenderer.ts constructor1 ${JSON.stringify(
77
+ opts.bounds
78
+ )}`
79
+ );
76
80
  this.offscreenWindow.setBounds(opts.bounds);
81
+ opts.logger.info(
82
+ `playlist-window-manager/src/BrowserWindowRenderer.ts constructor2 ${JSON.stringify(
83
+ {
84
+ bounds: this.offscreenWindow.getBounds(),
85
+ normalBounds: this.offscreenWindow.getNormalBounds(),
86
+ contentBounds: this.offscreenWindow.getContentBounds(),
87
+ }
88
+ )}`
89
+ );
90
+
91
+ this.offscreenWindow.maximize(); // TODO zlv added
77
92
  if (opts.proxySettings) {
78
93
  this.proxySettings = opts.proxySettings;
79
94
  }
@@ -189,6 +204,15 @@ export default class BrowserWindowRenderer
189
204
 
190
205
  if (window.view instanceof BrowserView) {
191
206
  this.moveWindowOffscreen(window);
207
+ this.logger.info(
208
+ `playlist-window-manager/src/BrowserWindowRenderer.ts createWindow2: ${JSON.stringify(
209
+ {
210
+ bounds: this.offscreenWindow.getBounds(),
211
+ normalBounds: this.offscreenWindow.getNormalBounds(),
212
+ contentBounds: this.offscreenWindow.getContentBounds(),
213
+ }
214
+ )}`
215
+ );
192
216
  }
193
217
 
194
218
  this.windows[windowId] = window;
@@ -204,11 +228,16 @@ export default class BrowserWindowRenderer
204
228
  }
205
229
 
206
230
  this.logger.info(
207
- `playlist-window-manager/src/BrowserWindowRenderer.ts createWindow2: ${JSON.stringify(
231
+ `playlist-window-manager/src/BrowserWindowRenderer.ts createWindow3: ${JSON.stringify(
208
232
  window.bounds
209
233
  )}`
210
234
  );
211
235
  window.view.setBounds(window.bounds);
236
+ this.logger.info(
237
+ `playlist-window-manager/src/BrowserWindowRenderer.ts createWindow4: ${JSON.stringify(
238
+ window.view.getBounds()
239
+ )}`
240
+ );
212
241
 
213
242
  if (this.proxySettings) {
214
243
  await window.view.webContents.session.setProxy(this.proxySettings);
@@ -490,12 +490,19 @@ export default class PresentationWindow {
490
490
  backgroundColor?: string,
491
491
  receiveMessageCallback?: (type: string, payload?: any) => void
492
492
  ) {
493
- const { windowId, parentWindowId, renderer, bounds } = this.options;
493
+ const { windowId, parentWindowId, renderer, bounds, logger } = this.options;
494
+
495
+ logger.info(
496
+ `playlist-window-manager/src/PresentationWindow.ts createAndLoadWindow1: ${JSON.stringify(
497
+ bounds
498
+ )}`
499
+ );
494
500
 
495
501
  renderer.createWindow({
496
502
  windowId,
497
503
  parentWindowId,
498
504
  bounds,
505
+ logger,
499
506
  backgroundColor,
500
507
  receiveMessageCallback,
501
508
  errorCallback: this.handleError,
package/src/types.ts CHANGED
@@ -86,6 +86,7 @@ export interface CreateWindowOptions {
86
86
  windowId: string;
87
87
  parentWindowId?: string;
88
88
  bounds?: WindowBounds;
89
+ logger: Logger;
89
90
  backgroundColor?: string;
90
91
 
91
92
  // Called when attaching a message listener to the inner window.