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

Function emit

src/interaction/createZoomState.ts:104–119  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

102 let normalizedMaxSpan = Math.max(minSpan, maxSpan);
103
104 const emit = (): void => {
105 const next: ZoomRange = { start, end };
106 if (
107 lastEmitted !== null &&
108 lastEmitted.start === next.start &&
109 lastEmitted.end === next.end
110 ) {
111 return;
112 }
113
114 lastEmitted = copyRange(next);
115
116 // Emit to a snapshot so additions/removals during emit don't affect this flush.
117 const snapshot = Array.from(listeners);
118 for (const cb of snapshot) cb({ start, end });
119 };
120
121 const toAnchor = (nextStart: number, nextEnd: number, spec?: ZoomRangeAnchor): { readonly center: number; readonly ratio: number } | undefined => {
122 if (!spec) return undefined;

Callers 1

applyNextRangeFunction · 0.70

Calls 1

copyRangeFunction · 0.85

Tested by

no test coverage detected