Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

thread-outbox.ts

29 lines1008 Bytes

1import type { EnvironmentId } from "@t3tools/contracts";
2​
3import { appAtomRegistry } from "./atom-registry";
4import { createThreadOutboxManager } from "./thread-outbox-manager";
5import type { QueuedThreadMessage } from "./thread-outbox-model";
6import { expoThreadOutboxStorage } from "./thread-outbox-storage";
7​
8export * from "./thread-outbox-model";
9​
10export const threadOutboxManager = createThreadOutboxManager({
11 registry: appAtomRegistry,
12 storage: expoThreadOutboxStorage,
13});
14​
15export function ensureThreadOutboxLoaded(): void {
16 void threadOutboxManager.load();
18​
19export function enqueueThreadOutboxMessage(message: QueuedThreadMessage): Promise<void> {
20 return threadOutboxManager.enqueue(message);
22​
23export function removeThreadOutboxMessage(message: QueuedThreadMessage): Promise<void> {
24 return threadOutboxManager.remove(message);
26​
27export function clearThreadOutboxEnvironment(environmentId: EnvironmentId): Promise<void> {
28 return threadOutboxManager.clearEnvironment(environmentId);