MCPcopy Create free account
hub / github.com/Wscats/chrome-devtools-cli / loop

Function loop

src/core/view/panel/ModelPanel/lib/showFpsAndMemory.ts:13–31  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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}

Callers

nothing calls this directly

Calls 1

getMemoryInfoFunction · 0.85

Tested by

no test coverage detected