MCPcopy Index your code
hub / github.com/CapSoftware/Cap / createDevicesQuery

Function createDevicesQuery

apps/desktop/src/utils/devices.ts:48–67  ·  view source on GitHub ↗
(enabled: Accessor<boolean> = () => true)

Source from the content-addressed store, hash-verified

46});
47
48export function createDevicesQuery(enabled: Accessor<boolean> = () => true) {
49 const query = useQuery(() => ({
50 ...devicesSnapshot,
51 enabled: enabled(),
52 refetchInterval: enabled() ? devicesSnapshot.refetchInterval : false,
53 }));
54
55 createEffect(() => {
56 const unlisten = events.devicesUpdated.listen(() => {
57 if (!enabled()) return;
58 query.refetch();
59 });
60
61 onCleanup(() => {
62 unlisten.then((fn) => fn());
63 });
64 });
65
66 return query;
67}
68
69type CameraDetailsCache = Record<
70 string,

Callers 3

RecordingControlsFunction · 0.90
ClipsSidebarInnerFunction · 0.90
createStableDevicesQueryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected