@raydiant/playlist-window-manager 0.0.0-test-1 → 0.0.0-test-3

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);
@@ -93,7 +93,7 @@ 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
98
  if (opts.proxySettings) {
99
99
  this.proxySettings = opts.proxySettings;
@@ -659,6 +659,7 @@ var PlaylistWindowManager = /** @class */ (function (_super) {
659
659
  var presentation = this.state.getPresentation(presentationId);
660
660
  var applicationVersion = this.state.getApplicationVersion(presentation.applicationDeploymentId);
661
661
  var windowId = (0, uuid_1.v4)();
662
+ logger.info("playlist-window-manager/src/PlaylistWindowManager.ts createWindow1 ".concat(JSON.stringify(this.bounds)));
662
663
  return new PresentationWindow_1.default({
663
664
  windowManager: this,
664
665
  renderer: this.renderer,
@@ -683,7 +684,7 @@ var PlaylistWindowManager = /** @class */ (function (_super) {
683
684
  ruleEngineState: this.ruleEngine.state,
684
685
  globalRule: this.ruleEngine.globalRule,
685
686
  isPreview: isPreview,
686
- workerState: this.workerState
687
+ workerState: this.workerState,
687
688
  });
688
689
  };
689
690
  PlaylistWindowManager.prototype.loadCurrentWindow = function () {
@@ -998,12 +999,12 @@ var PlaylistWindowManager = /** @class */ (function (_super) {
998
999
  };
999
1000
  PlaylistWindowManager.prototype.emitCurrentWindowErrorEvent = function (event, error) {
1000
1001
  return this.emitCurrentWindowEvent(event, {
1001
- errorMessage: this.getErrorMessage(error)
1002
+ errorMessage: this.getErrorMessage(error),
1002
1003
  });
1003
1004
  };
1004
1005
  PlaylistWindowManager.prototype.emitNextWindowErrorEvent = function (event, error) {
1005
1006
  return this.emitNextWindowEvent(event, {
1006
- errorMessage: this.getErrorMessage(error)
1007
+ errorMessage: this.getErrorMessage(error),
1007
1008
  });
1008
1009
  };
1009
1010
  PlaylistWindowManager.prototype.getErrorMessage = function (error) {
@@ -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,
@@ -818,8 +820,9 @@ var PresentationWindow = /** @class */ (function () {
818
820
  didBoundsChange = prevBounds
819
821
  ? !(0, fast_deep_equal_1.default)(bounds, prevBounds)
820
822
  : true;
823
+ this.logInfo("playlist-window-manager/src/PresentationWindow.ts openChildWindow1: ".concat(JSON.stringify(prevBounds)));
821
824
  if (didBoundsChange) {
822
- this.logInfo("playlist-window-manager/src/PresentationWindow.ts openChildWindow1: ".concat(JSON.stringify(bounds)));
825
+ this.logInfo("playlist-window-manager/src/PresentationWindow.ts openChildWindow2: ".concat(JSON.stringify(bounds)));
823
826
  windowManager.updateBounds(bounds);
824
827
  }
825
828
  didForceMuteChange = forceMute !== prevForceMute;
@@ -839,7 +842,7 @@ var PresentationWindow = /** @class */ (function () {
839
842
  }
840
843
  return [3 /*break*/, 3];
841
844
  case 1:
842
- this.logInfo("playlist-window-manager/src/PresentationWindow.ts openChildWindow2: ".concat(JSON.stringify(bounds)));
845
+ this.logInfo("playlist-window-manager/src/PresentationWindow.ts openChildWindow3: ".concat(JSON.stringify(bounds)));
843
846
  windowManager = new PlaylistWindowManager_1.default({
844
847
  parentWindowId: windowId,
845
848
  windowName: windowName,
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-1",
3
+ "version": "0.0.0-test-3",
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 +72,11 @@ 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);
77
81
  if (opts.proxySettings) {
78
82
  this.proxySettings = opts.proxySettings;
@@ -8,7 +8,7 @@ import {
8
8
  Theme,
9
9
  Logger,
10
10
  WorkerState,
11
- AnalyticsEvent
11
+ AnalyticsEvent,
12
12
  } from './types';
13
13
  import PresentationWindow from './PresentationWindow';
14
14
  import PlaylistWindowManagerState from './PlaylistWindowManagerState';
@@ -84,12 +84,12 @@ export default class PlaylistWindowManager extends EventEmitter {
84
84
  private overrideNextPresentation: RE.NextPresentationID | null = null;
85
85
  private currentWindow: PresentationWindow | null = null;
86
86
  private nextWindow: PresentationWindow | null = null;
87
- private hasPendingInterrupt: boolean = false;
87
+ private hasPendingInterrupt = false;
88
88
  private ruleEngine: RE.RuleEngine | null = null;
89
89
  private state: PlaylistWindowManagerState | null = null;
90
90
  private renderer: PresentationWindowRenderer | null = null;
91
- private restartCurrentWindowOnEnd: boolean = false;
92
- private shouldHardRestart: boolean = false;
91
+ private restartCurrentWindowOnEnd = false;
92
+ private shouldHardRestart = false;
93
93
  private currentWindowError: null | Error = null;
94
94
  private interruptCheckTimeout: ReturnType<typeof setTimeout> | null = null;
95
95
  private currentPresentationCompleteTimeout: ReturnType<
@@ -98,8 +98,8 @@ export default class PlaylistWindowManager extends EventEmitter {
98
98
  private lastCompleteAt: Date | null = null;
99
99
  private bounds?: WindowBounds;
100
100
  private themeOverride?: Theme;
101
- private forceMute: boolean = false;
102
- private isFocused: boolean = false;
101
+ private forceMute = false;
102
+ private isFocused = false;
103
103
 
104
104
  private workerState: WorkerState = {};
105
105
 
@@ -397,7 +397,7 @@ export default class PlaylistWindowManager extends EventEmitter {
397
397
  }
398
398
  }
399
399
 
400
- public async show(isFocused: boolean = true) {
400
+ public async show(isFocused = true) {
401
401
  if (this.currentWindow) {
402
402
  // Save the focused state so we know if preloaded windows should be
403
403
  // focused when swapped for the current.
@@ -450,7 +450,7 @@ export default class PlaylistWindowManager extends EventEmitter {
450
450
  logger,
451
451
  windowName,
452
452
  parentWindowId,
453
- isPreview
453
+ isPreview,
454
454
  } = this.options;
455
455
 
456
456
  if (!this.ruleEngine) {
@@ -480,6 +480,12 @@ export default class PlaylistWindowManager extends EventEmitter {
480
480
 
481
481
  const windowId = uuidv4();
482
482
 
483
+ logger.info(
484
+ `playlist-window-manager/src/PlaylistWindowManager.ts createWindow1 ${JSON.stringify(
485
+ this.bounds
486
+ )}`
487
+ );
488
+
483
489
  return new PresentationWindow({
484
490
  windowManager: this,
485
491
  renderer: this.renderer,
@@ -504,7 +510,7 @@ export default class PlaylistWindowManager extends EventEmitter {
504
510
  ruleEngineState: this.ruleEngine.state,
505
511
  globalRule: this.ruleEngine.globalRule,
506
512
  isPreview,
507
- workerState: this.workerState
513
+ workerState: this.workerState,
508
514
  });
509
515
  }
510
516
 
@@ -1006,7 +1012,7 @@ export default class PlaylistWindowManager extends EventEmitter {
1006
1012
  if (window) {
1007
1013
  this.emit(event, {
1008
1014
  ...window.metadata(),
1009
- data
1015
+ data,
1010
1016
  });
1011
1017
  } else {
1012
1018
  logger.warn(`Attempted to emit ${label} window event but window not set`);
@@ -1023,13 +1029,13 @@ export default class PlaylistWindowManager extends EventEmitter {
1023
1029
 
1024
1030
  private emitCurrentWindowErrorEvent(event: string, error: any) {
1025
1031
  return this.emitCurrentWindowEvent(event, {
1026
- errorMessage: this.getErrorMessage(error)
1032
+ errorMessage: this.getErrorMessage(error),
1027
1033
  });
1028
1034
  }
1029
1035
 
1030
1036
  private emitNextWindowErrorEvent(event: string, error: any) {
1031
1037
  return this.emitNextWindowEvent(event, {
1032
- errorMessage: this.getErrorMessage(error)
1038
+ errorMessage: this.getErrorMessage(error),
1033
1039
  });
1034
1040
  }
1035
1041
 
@@ -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,
@@ -666,9 +673,15 @@ export default class PresentationWindow {
666
673
  ? !deepEqual(bounds, prevBounds)
667
674
  : true;
668
675
 
676
+ this.logInfo(
677
+ `playlist-window-manager/src/PresentationWindow.ts openChildWindow1: ${JSON.stringify(
678
+ prevBounds
679
+ )}`
680
+ );
681
+
669
682
  if (didBoundsChange) {
670
683
  this.logInfo(
671
- `playlist-window-manager/src/PresentationWindow.ts openChildWindow1: ${JSON.stringify(
684
+ `playlist-window-manager/src/PresentationWindow.ts openChildWindow2: ${JSON.stringify(
672
685
  bounds
673
686
  )}`
674
687
  );
@@ -699,7 +712,7 @@ export default class PresentationWindow {
699
712
  }
700
713
  } else {
701
714
  this.logInfo(
702
- `playlist-window-manager/src/PresentationWindow.ts openChildWindow2: ${JSON.stringify(
715
+ `playlist-window-manager/src/PresentationWindow.ts openChildWindow3: ${JSON.stringify(
703
716
  bounds
704
717
  )}`
705
718
  );
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.