Files
openmaic/OpenMAIC/lib/makelore-runtime/progress-events.ts

18 lines
596 B
TypeScript

export const MAKELORE_PLAYBACK_PROGRESS_EVENT = 'makelore:playback-progress';
export type MakelorePlaybackProgress = {
sceneId: string;
sceneOrder: number;
actionIndex: number | null;
completed: boolean;
};
/** Publish playback detail only inside the verified offline player surface. */
export function emitMakelorePlaybackProgress(detail: MakelorePlaybackProgress): void {
if (typeof window === 'undefined' || !window.__MAKELORE_OFFLINE_PLAYER__) return;
window.dispatchEvent(new CustomEvent<MakelorePlaybackProgress>(
MAKELORE_PLAYBACK_PROGRESS_EVENT,
{ detail },
));
}