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

Function onPreference

packages/shared/src/hooks/useInAppLinks.ts:40–46  ·  view source on GitHub ↗
(event: Event)

Source from the content-addressed store, hash-verified

38 }
39 postReading(ReadingAction.Preference, { inApp: !isOptedOut });
40 const onPreference = (event: Event) => {
41 const { inApp } =
42 (event as CustomEvent<{ inApp?: boolean }>).detail ?? {};
43 if (typeof inApp === 'boolean' && inApp === isOptedOut) {
44 setOptedOutRef.current(!inApp);
45 }
46 };
47 window.addEventListener(ReadingEvent.Preference, onPreference);
48 return () =>
49 window.removeEventListener(ReadingEvent.Preference, onPreference);

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected