MCPcopy Create free account
hub / github.com/ampproject/amphtml / findEngagedTimeBetween

Function findEngagedTimeBetween

extensions/amp-analytics/0.1/activity-impl.js:43–51  ·  view source on GitHub ↗

* Find the engaged time between the event and the time (exclusive of the time) * @param {ActivityEventDef} activityEvent * @param {number} time * @return {number} * @private

(activityEvent, time)

Source from the content-addressed store, hash-verified

41 * @private
42 */
43function findEngagedTimeBetween(activityEvent, time) {
44 let engagementBonus = 0;
45
46 if (activityEvent.type === ActivityEventType.ACTIVE) {
47 engagementBonus = DEFAULT_ENGAGED_SECONDS;
48 }
49
50 return Math.min(time - activityEvent.time, engagementBonus);
51}
52
53class ActivityHistory {
54 /**

Callers 2

pushMethod · 0.85
getTotalEngagedTimeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected