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

Function triggerAnimation

app/core/utils.js:1666–1681  ·  view source on GitHub ↗
(DOMHighResTimeStamp)

Source from the content-addressed store, hash-verified

1664 const DOMHighResTimeStampCollection = []
1665
1666 const triggerAnimation = function (DOMHighResTimeStamp) {
1667 DOMHighResTimeStampCollection.unshift(DOMHighResTimeStamp)
1668 if (DOMHighResTimeStampCollection.length > 10) {
1669 const t0 = DOMHighResTimeStampCollection.pop()
1670 const fps = Math.floor((1000 * 10) / (DOMHighResTimeStamp - t0))
1671 if (!callbackTriggered) {
1672 callback.call(undefined, fps, DOMHighResTimeStampCollection)
1673 }
1674 if (runIndefinitely) {
1675 callbackTriggered = false
1676 } else {
1677 callbackTriggered = true
1678 }
1679 }
1680 requestId = window.requestAnimationFrame(triggerAnimation)
1681 }
1682
1683 window.requestAnimationFrame(triggerAnimation)
1684 // Stop after half second if it shouldn't run indefinitely

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected