@humanmark/sdk-js
Version:
Browser-native JavaScript SDK for Humanmark human verification challenges
27 lines • 1.09 kB
TypeScript
/**
* Retry utility functions
* Helper functions for implementing retry logic with exponential backoff
*/
/**
* Calculates the retry delay with exponential backoff and jitter
* @param attempt - The current attempt number (0-based)
* @returns Delay in milliseconds
*/
export declare function calculateRetryDelay(attempt: number): number;
/**
* Creates a cancellable delay promise
* @param ms - Delay in milliseconds
* @param signal - Optional abort signal
* @returns Promise that resolves after delay or rejects if cancelled
*/
export declare function delay(ms: number, signal?: AbortSignal): Promise<void>;
/**
* Checks if we should continue retrying based on time and attempt limits
* @param attempt - Current attempt number
* @param startTime - When the operation started
* @param maxTime - Maximum total time allowed
* @param maxAttempts - Maximum number of attempts
* @returns true if we should continue retrying
*/
export declare function shouldRetry(attempt: number, startTime: number, maxTime: number, maxAttempts?: number): boolean;
//# sourceMappingURL=retry.d.ts.map