()
| 235 | // Cleanup |
| 236 | let cleanedUp = false; |
| 237 | const cleanup = (): void => { |
| 238 | if (cleanedUp) return; |
| 239 | cleanedUp = true; |
| 240 | streaming = false; |
| 241 | if (intervalId !== null) clearInterval(intervalId); |
| 242 | ro.disconnect(); |
| 243 | chart.dispose(); |
| 244 | }; |
| 245 | |
| 246 | window.addEventListener('beforeunload', cleanup); |
| 247 | import.meta.hot?.dispose(cleanup); |