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

Function attachCoalescedResizeObserver

examples/interactive/main.ts:86–103  ·  view source on GitHub ↗
(
  containers: ReadonlyArray<HTMLElement>,
  charts: ReadonlyArray<ChartGPUInstance>
)

Source from the content-addressed store, hash-verified

84};
85
86const attachCoalescedResizeObserver = (
87 containers: ReadonlyArray<HTMLElement>,
88 charts: ReadonlyArray<ChartGPUInstance>
89): ResizeObserver => {
90 let rafId: number | null = null;
91
92 const schedule = (): void => {
93 if (rafId !== null) return;
94 rafId = requestAnimationFrame(() => {
95 rafId = null;
96 for (const chart of charts) chart.resize();
97 });
98 };
99
100 const ro = new ResizeObserver(() => schedule());
101 for (const el of containers) ro.observe(el);
102 return ro;
103};
104
105const createOptions = (
106 title: string,

Callers 1

mainFunction · 0.70

Calls 1

scheduleFunction · 0.70

Tested by

no test coverage detected