9 lines
458 B
TypeScript
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();
|
|
}
|