ts-batch-fetch
Version:
A concurrency-controlled fetch library for browsers using ts-batch-processor
32 lines (31 loc) • 984 B
TypeScript
import type { BatchFetchConfig } from "./types";
/**
* Global configuration singleton for batch fetch operations
*/
export default class GlobalConfig {
private _config;
private static _instance;
private constructor();
static get instance(): GlobalConfig;
get concurrency(): number;
set concurrency(value: number);
get timeout(): number;
set timeout(value: number);
get defaultInit(): RequestInit;
set defaultInit(value: RequestInit);
get config(): BatchFetchConfig;
/**
* Update the global configuration
*/
updateConfig(config: Partial<BatchFetchConfig>): void;
private validateConcurrency;
private validateTimeout;
private validateConfig;
/**
* Reset configuration to defaults
*/
resetToDefaults(): void;
}
export declare const getConfig: () => BatchFetchConfig;
export declare const updateConfig: (config: Partial<BatchFetchConfig>) => void;
export declare const resetConfig: () => void;