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

Function init

examples/worker-rendering/main.ts:728–776  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

726// ============================================================================
727
728function init(): void {
729 initializeMetricsDisplay();
730
731 // Initialize total points display
732 updateTotalPointsDisplay();
733
734 // Button event listeners
735 document.getElementById('btnGenerate')?.addEventListener('click', handleGenerate);
736 document.getElementById('btnStream')?.addEventListener('click', handleStartStreaming);
737 document.getElementById('btnClear')?.addEventListener('click', handleClear);
738 document.getElementById('btnEmergency')?.addEventListener('click', handleEmergencyStop);
739
740 // Update total points display when inputs change
741 document.getElementById('pointCount')?.addEventListener('input', () => updateTotalPointsDisplay());
742 document.getElementById('seriesCount')?.addEventListener('input', () => updateTotalPointsDisplay());
743
744 // Resize handling
745 let resizeScheduled = false;
746 const resizeObserver = new ResizeObserver(() => {
747 if (resizeScheduled || !state.chart) return;
748 resizeScheduled = true;
749 requestAnimationFrame(() => {
750 resizeScheduled = false;
751 state.chart?.resize();
752 });
753 });
754
755 const container = document.getElementById('chart');
756 if (container) {
757 resizeObserver.observe(container);
758 }
759
760 // Cleanup on page unload
761 window.addEventListener('beforeunload', () => {
762 stopStreaming();
763 disposeChart();
764 });
765
766 // HMR cleanup
767 if (import.meta.hot) {
768 import.meta.hot.dispose(() => {
769 stopStreaming();
770 disposeChart();
771 resizeObserver.disconnect();
772 });
773 }
774
775 showStatus('Ready. Configure and generate your benchmark.', 'success');
776}
777
778// Start the app
779if (document.readyState === 'loading') {

Callers 1

main.tsFile · 0.70

Calls 7

initializeMetricsDisplayFunction · 0.85
updateTotalPointsDisplayFunction · 0.85
showStatusFunction · 0.85
stopStreamingFunction · 0.70
disposeChartFunction · 0.70
resizeMethod · 0.65
disposeMethod · 0.65

Tested by

no test coverage detected