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

Method handleReadyMessage

src/worker/ChartGPUWorkerProxy.ts:1849–1885  ·  view source on GitHub ↗

* Handles ready message from worker. * Resolves the pending init request and caches performance capabilities.

(message: ReadyMessage)

Source from the content-addressed store, hash-verified

1847 * Resolves the pending init request and caches performance capabilities.
1848 */
1849 private handleReadyMessage(message: ReadyMessage): void {
1850 // Mark as initialized to enable event forwarding
1851 this.isInitialized = true;
1852
1853 // Cache performance capabilities from worker
1854 this.cachedPerformanceCapabilities = message.performanceCapabilities;
1855
1856 // CRITICAL: Initialize zoom range from ready message
1857 // The ready message now includes the initial zoom range to avoid race conditions
1858 // where the slider is created with default [0, 100] before the worker's zoomChange message is processed
1859 if (message.initialZoomRange) {
1860 // Update cached zoom range
1861 this.cachedZoomRange = { start: message.initialZoomRange.start, end: message.initialZoomRange.end };
1862
1863 // If slider exists, update it with the correct initial zoom range
1864 if (this.zoomState) {
1865 const currentRange = this.zoomState.getRange();
1866 // Only update if the slider is still at the default [0, 100] but actual range differs
1867 if ((currentRange.start === 0 && currentRange.end === 100) &&
1868 (message.initialZoomRange.start !== 0 || message.initialZoomRange.end !== 100)) {
1869 this.isProcessingWorkerZoomUpdate = true;
1870 try {
1871 this.zoomState.setRange(message.initialZoomRange.start, message.initialZoomRange.end);
1872 } finally {
1873 this.isProcessingWorkerZoomUpdate = false;
1874 }
1875 }
1876 }
1877 }
1878
1879 const pending = this.pendingRequests.get(message.messageId);
1880 if (pending) {
1881 clearTimeout(pending.timeout);
1882 this.pendingRequests.delete(message.messageId);
1883 pending.resolve(message);
1884 }
1885 }
1886
1887 /**
1888 * Handles hover change messages from worker.

Callers 1

handleWorkerMessageMethod · 0.95

Calls 2

getRangeMethod · 0.80
setRangeMethod · 0.80

Tested by

no test coverage detected