()
| 11 | return Math.round((window.performance).memory.usedJSHeapSize / (1024 * 1024)); |
| 12 | }; |
| 13 | const loop = () => { |
| 14 | const now = Date.now(); |
| 15 | // 每运行一次, frame++ |
| 16 | frame += 1; |
| 17 | // 1s更新一次面板 |
| 18 | if (now > 1000 + lastTime) { |
| 19 | const fps = Math.round((frame * 1000) / (now - lastTime)); |
| 20 | frame = 0; |
| 21 | lastTime = now; |
| 22 | window.postMessage({ |
| 23 | source: 'tencent-docs-devtools-inject', |
| 24 | payload: { |
| 25 | memory: getMemoryInfo(), |
| 26 | fps |
| 27 | } |
| 28 | }, '*'); |
| 29 | } |
| 30 | window.animationFrameID = window.requestAnimationFrame(loop); |
| 31 | }; |
| 32 | window.animationFrameID = window.requestAnimationFrame(loop); |
| 33 | })(); |
| 34 | } |
nothing calls this directly
no test coverage detected