MCPcopy Create free account
hub / github.com/pgadmin-org/pgadmin4 / useInterval

Function useInterval

web/pgadmin/static/js/custom_hooks.js:16–31  ·  view source on GitHub ↗
(callback, delay)

Source from the content-addressed store, hash-verified

14
15/* React hook for setInterval */
16export function useInterval(callback, delay) {
17 const savedCallback = useRef();
18 savedCallback.current = callback;
19
20 useEffect(() => {
21 function tick() {
22 savedCallback.current();
23 }
24
25 if(delay > -1) {
26 tick();
27 let id = setInterval(tick, delay);
28 return () => clearInterval(id);
29 }
30 }, [delay]);
31}
32
33/* React hook for handling double and single click events */
34export function useSingleAndDoubleClick(handleSingleClick, handleDoubleClick, delay = 250) {

Callers 9

QueryToolComponentFunction · 0.90
ProcessDetailsFunction · 0.90
GraphsFunction · 0.90
PGDReplicationFunction · 0.90
MemoryFunction · 0.90
CpuDetailsFunction · 0.90
StorageFunction · 0.90
SummaryFunction · 0.90
useStopwatchFunction · 0.85

Calls 1

tickFunction · 0.85

Tested by

no test coverage detected