Skip to content

Commit

Permalink
feat: Add communication with training mode to auto-fullscreen windows
Browse files Browse the repository at this point in the history
Closes #2073
  • Loading branch information
zusorio committed Dec 16, 2024
1 parent 7435a56 commit d751a1f
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion frontend/src/app/sessions/session/session-viewer.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,23 @@ export class SessionViewerService {
private domSanitizer: DomSanitizer,
private toastService: ToastService,
private sessionsService: SessionsService,
) {}
) {
window.addEventListener('message', (event) => {
if (event.origin !== window.location.origin) {
return;
}

if (event.data.type === 'setFullscreen') {
const session = this._sessions.value?.find(
(session) => session.id === event.data.sessionId,
);

if (session && event.data.fullscreen !== session.fullscreen) {
this.toggleFullscreen(session);
}
}
});
}

private _sessions = new BehaviorSubject<ViewerSession[] | undefined>(
undefined,
Expand Down

0 comments on commit d751a1f

Please sign in to comment.