🎥 Make videos programmatically with React
refactor(core): publish runtime value snapshots
Noah Lindnerf47c8bdd42f0
diff --git a/packages/core/src/TimelineContext.tsx b/packages/core/src/TimelineContext.tsxindex 48d01992c7..483f54b8f5 100644--- a/packages/core/src/TimelineContext.tsx+++ b/packages/core/src/TimelineContext.tsx@@ -28,7 +28,9 @@ export type PlaybackRateContextValue = {export type SetTimelineContextValue = {setFrame: (u: React.SetStateAction<Record<string, number>>) => void;setPlaying: (u: React.SetStateAction<boolean>) => void;- subscribePlaying: (listener: () => void) => () => void;+ subscribePlaying: (+ listener: (state: Readonly<{playing: boolean}>) => void,+ ) => () => void;frameRef: RefObject<Record<string, number>>;isPlaying: () => boolean;audioAndVideoTags: RefObject<PlayableMediaTag[]>;diff --git a/packages/core/src/runtime-value-store.ts b/packages/core/src/runtime-value-store.tsindex f311258162..890e59ab5d 100644--- a/packages/core/src/runtime-value-store.ts+++ b/packages/core/src/runtime-value-store.ts@@ -4,7 +4,7 @@ export type RuntimeValueStore<TSnapshot extends RuntimeValueSnapshot = RuntimeValueSnapshot,> = {getSnapshot: () => TSnapshot;- subscribe: (listener: () => void) => () => void;+ subscribe: (listener: (snapshot: TSnapshot) => void) => () => void;};export type RuntimeValueStoreController<@@ -18,7 +18,7 @@ export const createRuntimeValueStore = <TSnapshot extends RuntimeValueSnapshot>(initialSnapshot: TSnapshot,): RuntimeValueStoreController<TSnapshot> => {let snapshot = initialSnapshot;- const listeners = new Set<() => void>();+ const listeners = new Set<(snapshot: TSnapshot) => void>();const store: RuntimeValueStore<TSnapshot> = {getSnapshot: () => snapshot,@@ -39,7 +39,7 @@ export const createRuntimeValueStore = <TSnapshot extends RuntimeValueSnapshot>(snapshot = newSnapshot;for (const listener of listeners) {- listener();+ listener(snapshot);}},};