@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 16 lines 582 Bytes
Raw
1 import { AppState } from "react-native";
2 import { scheduleOnUI } from "react-native-worklets";
3
4 function collectUiRuntimeGarbage() {
5 "worklet";
6 const gc = (globalThis as { gc?: () => void }).gc;
7 if (typeof gc === "function") gc();
8 }
9
10 /** iOS memory warnings collect only RN's heap; collect worklets too to release shadow nodes and serializables. */
11 export function installUiRuntimeMemoryWarningGc(): () => void {
12 const subscription = AppState.addEventListener("memoryWarning", () => {
13 scheduleOnUI(collectUiRuntimeGarbage);
14 });
15 return () => subscription.remove();
16 }