14 lines
410 B
TypeScript
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 }));
|
|
}
|