@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
ts 21 lines 705 Bytes
Raw
1 export interface FoundationHotModule {
2 readonly accept: (callback?: () => void) => void;
3 readonly dispose: (callback: () => void) => void;
4 }
5
6 export function disposeOnFoundationReplace(
7 hotModule: FoundationHotModule | undefined,
8 dispose: () => void | Promise<void>,
9 ): void {
10 if (hotModule === undefined || typeof __DEV__ === "undefined" || !__DEV__) return;
11
12 hotModule.dispose(() => {
13 try {
14 void Promise.resolve(dispose()).catch((error: unknown) => {
15 console.error("[fast-refresh] could not dispose replaced mobile foundation", error);
16 });
17 } catch (error) {
18 console.error("[fast-refresh] could not dispose replaced mobile foundation", error);
19 }
20 });
21 }