fiddy/apps/web/lib/client/entry-mutation-events.ts
2026-02-11 23:45:15 -08:00

14 lines
410 B
TypeScript

import type { Entry } from "@/lib/shared/types";
export const ENTRY_MUTATED_EVENT = "fiddy:entry-mutated";
export type EntryMutationDetail = {
before: Entry | null;
after: Entry | null;
};
export function emitEntryMutated(detail: EntryMutationDetail) {
if (typeof window === "undefined") return;
window.dispatchEvent(new CustomEvent<EntryMutationDetail>(ENTRY_MUTATED_EVENT, { detail }));
}