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

Function evaluate

packages/shared/src/features/monetization/useViewability.ts:76–88  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

74 // The duration has to be continuous, so losing the ratio or the tab focus
75 // drops the accumulated time instead of pausing it.
76 const evaluate = () => {
77 if (!criteria || !meetsRatio || !isPageInFocus()) {
78 stopTimer();
79 return;
80 }
81
82 if (timeout) {
83 return;
84 }
85
86 const met = criteria;
87 timeout = setTimeout(() => reportViewable(met), met.duration);
88 };
89
90 const observer = new IntersectionObserver(
91 (entries) => {

Callers 1

useViewabilityFunction · 0.85

Calls 3

isPageInFocusFunction · 0.85
reportViewableFunction · 0.85
stopTimerFunction · 0.70

Tested by

no test coverage detected