MCPcopy Index your code
hub / github.com/ChartGPU/ChartGPU / attachResizeObserver

Function attachResizeObserver

examples/worker-convenience/main.ts:81–96  ·  view source on GitHub ↗

* Attach resize observer with RAF coalescing

(
  container: HTMLElement,
  chart: ChartGPUInstance
)

Source from the content-addressed store, hash-verified

79 * Attach resize observer with RAF coalescing
80 */
81function attachResizeObserver(
82 container: HTMLElement,
83 chart: ChartGPUInstance
84): ResizeObserver {
85 let scheduled = false;
86 const ro = new ResizeObserver(() => {
87 if (scheduled) return;
88 scheduled = true;
89 requestAnimationFrame(() => {
90 scheduled = false;
91 chart.resize();
92 });
93 });
94 ro.observe(container);
95 return ro;
96}
97
98async function main(): Promise<void> {
99 const container1 = document.getElementById('chart1');

Callers 1

mainFunction · 0.70

Calls 1

resizeMethod · 0.65

Tested by

no test coverage detected