tus-js-client-stall-detection
Version:
A pure JavaScript client for the tus resumable upload protocol (fork with stall detection)
33 lines (32 loc) • 938 B
TypeScript
import type { StallDetectionOptions } from './options.js';
export declare class StallDetector {
private options;
private onStallDetected;
private intervalId;
private lastProgressTime;
private lastProgressValue;
private isActive;
constructor(options: StallDetectionOptions, onStallDetected: (reason: string) => void);
/**
* Start monitoring for stalls
* @param initialProgress Optional initial progress value to start with
*/
start(initialProgress?: number): void;
/**
* Stop monitoring for stalls
*/
stop(): void;
/**
* Update progress information
* @param progressValue The current progress value (bytes uploaded)
*/
updateProgress(progressValue: number): void;
/**
* Check if upload has stalled based on progress events
*/
private _isProgressStalled;
/**
* Handle a detected stall
*/
private _handleStall;
}