MCPcopy Create free account
hub / github.com/dailydotdev/apps / subscribe

Function subscribe

packages/shared/src/components/shell/useOnline.ts:3–11  ·  view source on GitHub ↗
(listener: () => void)

Source from the content-addressed store, hash-verified

1import { useSyncExternalStore } from 'react';
2
3const subscribe = (listener: () => void) => {
4 window.addEventListener('online', listener);
5 window.addEventListener('offline', listener);
6
7 return () => {
8 window.removeEventListener('online', listener);
9 window.removeEventListener('offline', listener);
10 };
11};
12
13export const useOnline = (): boolean =>
14 useSyncExternalStore(

Callers 2

ProfileTopActionsFunction · 0.50
FollowButtonFunction · 0.50

Calls

no outgoing calls

Tested by

no test coverage detected