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

Function attachCoalescedResizeObserver

examples/data-update-animation/main.ts:147–164  ·  view source on GitHub ↗
(
  containers: ReadonlyArray<HTMLElement>,
  charts: ReadonlyArray<ChartGPUInstance>
)

Source from the content-addressed store, hash-verified

145};
146
147const attachCoalescedResizeObserver = (
148 containers: ReadonlyArray<HTMLElement>,
149 charts: ReadonlyArray<ChartGPUInstance>
150): ResizeObserver => {
151 let rafId: number | null = null;
152
153 const schedule = (): void => {
154 if (rafId !== null) return;
155 rafId = requestAnimationFrame(() => {
156 rafId = null;
157 for (const chart of charts) chart.resize();
158 });
159 };
160
161 const ro = new ResizeObserver(() => schedule());
162 for (const el of containers) ro.observe(el);
163 return ro;
164};
165
166async function main(): Promise<void> {
167 const cartesianEl = document.getElementById('chart-cartesian');

Callers 1

mainFunction · 0.70

Calls 1

scheduleFunction · 0.70

Tested by

no test coverage detected