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

Function attachCoalescedResizeObserver

examples/sampling/main.ts:47–63  ·  view source on GitHub ↗
(
  containers: ReadonlyArray<HTMLElement>,
  charts: ReadonlyArray<ChartGPUInstance>
)

Source from the content-addressed store, hash-verified

45};
46
47const attachCoalescedResizeObserver = (
48 containers: ReadonlyArray<HTMLElement>,
49 charts: ReadonlyArray<ChartGPUInstance>
50): ResizeObserver => {
51 let rafId: number | null = null;
52 const schedule = (): void => {
53 if (rafId !== null) return;
54 rafId = requestAnimationFrame(() => {
55 rafId = null;
56 for (const chart of charts) chart.resize();
57 });
58 };
59
60 const ro = new ResizeObserver(() => schedule());
61 for (const el of containers) ro.observe(el);
62 return ro;
63};
64
65const normalizeSamplingMode = (value: string | null): SeriesSampling => {
66 switch (value) {

Callers 1

mainFunction · 0.70

Calls 1

scheduleFunction · 0.70

Tested by

no test coverage detected