UNPKG

safeer-pdf-generator

Version:

Framework-agnostic PDF generation library with chunking, merging, S3 upload, and email delivery

62 lines 1.71 kB
/** * High-resolution timer for performance measurement */ export declare class Timer { private startTime; private marks; constructor(); /** * Mark a point in time with a label */ mark(label: string): void; /** * Get elapsed time since timer creation in milliseconds */ elapsed(): number; /** * Get elapsed time since a specific mark in milliseconds */ elapsedSince(label: string): number; /** * Get time between two marks in milliseconds */ duration(startLabel: string, endLabel: string): number; /** * Get all marks with their timestamps */ getAllMarks(): Record<string, number>; /** * Reset the timer */ reset(): void; } /** * Simple sleep function for delays */ export declare function sleep(ms: number): Promise<void>; /** * Timeout wrapper for promises */ export declare function withTimeout<T>(promise: Promise<T>, timeoutMs: number, timeoutMessage?: string): Promise<T>; /** * Retry function with exponential backoff */ export declare function retry<T>(fn: () => Promise<T>, options?: { attempts?: number; delay?: number; backoff?: number; shouldRetry?: (error: any, attempt: number) => boolean; }): Promise<T>; /** * Format duration in human-readable format */ export declare function formatDuration(ms: number): string; /** * Create a debounced version of a function */ export declare function debounce<T extends (...args: any[]) => any>(func: T, wait: number): T; /** * Create a throttled version of a function */ export declare function throttle<T extends (...args: any[]) => any>(func: T, limit: number): T; //# sourceMappingURL=timing.d.ts.map