()
| 1788 | |
| 1789 | class FpsMonitor { |
| 1790 | constructor() { |
| 1791 | this.frameCount = 0; |
| 1792 | this.accumulatedTime = 0; |
| 1793 | this.lastTimestamp = 0; |
| 1794 | this.lastFrameTimestamp = 0; |
| 1795 | this.currentFps = null; |
| 1796 | |
| 1797 | this.root = document.createElement("div"); |
| 1798 | this.root.className = "fps-overlay"; |
| 1799 | |
| 1800 | this.valueElement = document.createElement("span"); |
| 1801 | this.valueElement.className = "fps-overlay__value"; |
| 1802 | this.valueElement.textContent = "— fps"; |
| 1803 | |
| 1804 | this.root.appendChild(this.valueElement); |
| 1805 | document.body.appendChild(this.root); |
| 1806 | this.refreshDisplay = this.refreshDisplay.bind(this); |
| 1807 | this.displayTimer = window.setInterval(this.refreshDisplay, 250); |
| 1808 | this.refreshDisplay(); |
| 1809 | } |
| 1810 | |
| 1811 | update(time) { |
| 1812 | if (!Number.isFinite(time)) return; |
nothing calls this directly
no test coverage detected