@gotake/gotake-sdk
Version:
SDK for interacting with GoTake blockchain contracts
56 lines • 1.77 kB
TypeScript
import { VideoStatusInfo, StatusCallback, PollController } from '../types';
export declare class StatusTracker {
private static instance;
private emitter;
private videoStatuses;
private activePolls;
private constructor();
/**
* Get StatusTracker singleton instance
*/
static getInstance(): StatusTracker;
/**
* Update status of a video
* @param videoId Video ID
* @param status New status information
*/
updateStatus(videoId: string, status: Partial<VideoStatusInfo>): void;
/**
* Get current status of a video
* @param videoId Video ID
* @returns Status information or undefined if not found
*/
getStatus(videoId: string): VideoStatusInfo | undefined;
/**
* Subscribe to status updates for a video
* @param videoId Video ID
* @param callback Function to call when status changes
* @returns Subscription object
*/
subscribe(videoId: string, callback: StatusCallback): {
unsubscribe: () => void;
};
/**
* Start polling for status updates
* @param videoId Video ID
* @param statusFetcher Function to fetch the latest status
* @param options Polling options
* @returns Poll controller
*/
startPolling(videoId: string, statusFetcher: () => Promise<VideoStatusInfo>, options: {
interval?: number;
stopCondition?: (status: VideoStatusInfo) => boolean;
callback: StatusCallback;
}): PollController;
/**
* Stop polling for a video
* @param videoId Video ID
*/
private stopPolling;
/**
* Clear all data for a video
* @param videoId Video ID
*/
clearVideo(videoId: string): void;
}
//# sourceMappingURL=statusTracker.d.ts.map