Function
attachCoalescedResizeObserver
(container: HTMLElement, chart: ChartGPUInstance)
Source from the content-addressed store, hash-verified
| 59 | }); |
| 60 | |
| 61 | const attachCoalescedResizeObserver = (container: HTMLElement, chart: ChartGPUInstance): ResizeObserver => { |
| 62 | let rafId: number | null = null; |
| 63 | const ro = new ResizeObserver(() => { |
| 64 | if (rafId !== null) return; |
| 65 | rafId = requestAnimationFrame(() => { |
| 66 | rafId = null; |
| 67 | chart.resize(); |
| 68 | }); |
| 69 | }); |
| 70 | ro.observe(container); |
| 71 | return ro; |
| 72 | }; |
| 73 | |
| 74 | const createSeedData = (count: number): DataPoint[] => { |
| 75 | const n = Math.max(2, Math.floor(count)); |
Tested by
no test coverage detected