()
| 228 | |
| 229 | let cleanedUp = false; |
| 230 | const cleanup = (): void => { |
| 231 | if (cleanedUp) return; |
| 232 | cleanedUp = true; |
| 233 | if (rafId !== null) cancelAnimationFrame(rafId); |
| 234 | ro.disconnect(); |
| 235 | chart.dispose(); |
| 236 | }; |
| 237 | |
| 238 | window.addEventListener('beforeunload', cleanup); |
| 239 | import.meta.hot?.dispose(cleanup); |