29 lines · 1008 B · TypeScript
RawDownload
import type { EnvironmentId } from "@t3tools/contracts"; import { appAtomRegistry } from "./atom-registry";import { createThreadOutboxManager } from "./thread-outbox-manager";import type { QueuedThreadMessage } from "./thread-outbox-model";import { expoThreadOutboxStorage } from "./thread-outbox-storage"; export * from "./thread-outbox-model"; export const threadOutboxManager = createThreadOutboxManager({  registry: appAtomRegistry,  storage: expoThreadOutboxStorage,}); export function ensureThreadOutboxLoaded(): void {  void threadOutboxManager.load();} export function enqueueThreadOutboxMessage(message: QueuedThreadMessage): Promise<void> {  return threadOutboxManager.enqueue(message);} export function removeThreadOutboxMessage(message: QueuedThreadMessage): Promise<void> {  return threadOutboxManager.remove(message);} export function clearThreadOutboxEnvironment(environmentId: EnvironmentId): Promise<void> {  return threadOutboxManager.clearEnvironment(environmentId);}