YC (S26) | Open Computer History | Continuously record your company computer work, map your workflows, help you find work worth automating, and power your agents' context
Rust agentsagiaiai-memoryaudio-recordingcomputer-visionhermeshermes-agentllmlocal-ailocal-firstmachine-learningmcpmultimodalopenclawprivacyrewindscreen-recordingspeech-to-textycombinator
hook to handle timer for periodic requests
matthew-heartfuld26a1b7568ed
diff --git a/screenpipe-app-tauri/lib/hooks/use-interval.tsx b/screenpipe-app-tauri/lib/hooks/use-interval.tsxnew file mode 100644index 000000000..d32aa8faa--- /dev/null+++ b/screenpipe-app-tauri/lib/hooks/use-interval.tsx@@ -0,0 +1,16 @@+import { useEffect, useRef } from 'react';++export function useInterval(callback: () => void, delay: number | null) {+ const savedCallback = useRef(callback);++ useEffect(() => {+ savedCallback.current = callback;+ }, [callback]);++ useEffect(() => {+ if (delay !== null) {+ const id = setInterval(() => savedCallback.current(), delay);+ return () => clearInterval(id);+ }+ }, [delay]);+}\ No newline at end of file