28 lines
962 B
TypeScript
28 lines
962 B
TypeScript
|
|
/**
|
||
|
|
* Internal: the React Context object backing `SessionProvider`.
|
||
|
|
*
|
||
|
|
* Lives in its own module so `EngineContext.tsx` can subscribe without
|
||
|
|
* importing the full `SessionContext.tsx` (which would re-export the
|
||
|
|
* EngineProvider via the same `@work` barrel and create a circular
|
||
|
|
* dependency at module-init time).
|
||
|
|
*/
|
||
|
|
|
||
|
|
import { createContext } from "react";
|
||
|
|
|
||
|
|
import type { SessionId } from "@shared/ids";
|
||
|
|
|
||
|
|
import type { EventBus, SessionService } from "@engine/index";
|
||
|
|
import type { PdfByteStore } from "@source/index";
|
||
|
|
|
||
|
|
export interface SessionInternalContextValue {
|
||
|
|
readonly service: SessionService;
|
||
|
|
readonly bus: EventBus;
|
||
|
|
readonly activeId: SessionId | null;
|
||
|
|
readonly hydrated: boolean;
|
||
|
|
getOrCreateByteStore(sessionId: SessionId): PdfByteStore;
|
||
|
|
getSessionVersion(sessionId: SessionId): number;
|
||
|
|
bumpSessionVersion(sessionId: SessionId): void;
|
||
|
|
}
|
||
|
|
|
||
|
|
export const SessionInternalContext = createContext<SessionInternalContextValue | null>(null);
|