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

Function watchPosts

packages/shared/src/hooks/usePostPrefetch.ts:80–90  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

78 const seen = new WeakSet<Element>();
79 let scan = 0;
80 const watchPosts = () => {
81 scan = 0;
82 document
83 .querySelectorAll<HTMLAnchorElement>('main a[href^="/posts/"]')
84 .forEach((anchor) => {
85 if (!seen.has(anchor)) {
86 seen.add(anchor);
87 near.observe(anchor);
88 }
89 });
90 };
91 const added = new MutationObserver(() => {
92 if (!scan) {
93 scan = requestAnimationFrame(watchPosts);

Callers 1

usePostPrefetchFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected