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

Function evaluate

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

Source from the content-addressed store, hash-verified

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

Callers 1

useViewabilityFunction · 0.70

Calls 3

isPageInFocusFunction · 0.90
reportViewableFunction · 0.85
stopTimerFunction · 0.70

Tested by

no test coverage detected