Files
2026-10-26 18:45:45 +08:00

9 lines
458 B
TypeScript

/** Attribute only the synchronous load call. The diagnostics wrapper carries its label into completion. */
export function withDiagnosticSource<T>(source: string, action: () => T): T {
const diagnostics = typeof window !== 'undefined' && (window as any).__memoryDiagnostics;
if (diagnostics && diagnostics.enabled && typeof diagnostics.withSource === 'function') {
return diagnostics.withSource(source, action);
}
return action();
}