MCPcopy Create free account
hub / github.com/codecombat/codecombat / stopTimer

Method stopTimer

app/core/ViewVisibleTimer.js:88–103  ·  view source on GitHub ↗
(param)

Source from the content-addressed store, hash-verified

86 }
87
88 stopTimer (param) {
89 if (param == null) { param = { } }
90 let { subtractTimeout, clearName } = param
91 if (subtractTimeout == null) { subtractTimeout = false }
92 if (clearName == null) { clearName = false }
93 clearTimeout(this.awayTimeoutId)
94 if (this.running) {
95 this.running = false
96 this.endTime = subtractTimeout ? this.lastActive : window.performance.now()
97 const timeViewed = this.endTime - this.startTime
98 if (timeViewed > this.throttleRate) { // Prevent event spam when triggered in rapid succession
99 window.tracker.trackEvent('Premium Feature Viewed', { featureData: this.featureData, timeViewed })
100 }
101 }
102 if (clearName) { this.featureData = null }
103 }
104
105 markLastActive () {
106 this.lastActive = window.performance.now()

Callers 3

onAwayMethod · 0.95
onHiddenMethod · 0.95
destroyMethod · 0.95

Calls 1

trackEventMethod · 0.45

Tested by

no test coverage detected