export interface IProgressTime { /** * Start time. */ start: number; /** * Current time. */ now: number; /** * Current duration. */ duration: number; /** * Delta since last update. */ delta: number; } export interface IProgressTotal { /** * Total amount. */ total: number; /** * Current amount. */ current: number; /** * Remaining amount. */ remaining: number; /** * Delta since last update. */ delta: number; } export declare type ProgressCallback = (time: IProgressTime, total: IProgressTotal) => void; /** * Progress wrapper. * * @param total Total progress. * @param current Starting progress. */ export declare class Progress extends Object { /** * Total amount. */ protected readonly _total: number; /** * Current amount. */ protected _current: number; /** * Update interval. */ protected _interval: any; /** * Update callback. */ protected _callback: ProgressCallback | null; /** * Start time. */ protected _start: number; /** * Previous update time. */ protected _prevTime: number; /** * Previous update total. */ protected _prevCurrent: number; constructor(total: number, current?: number); /** * Get the current time. * * @returns Current time in milliseconds. */ now(): number; /** * Set to current amount. * * @param amount Amount to be set. */ set(amount: number): void; /** * Add to current amount. * * @param amount Amount to be added. */ add(amount: number): void; /** * Start updater. * * @param interval Update interval in miliseconds. * @param cb Progress callback. */ start(interval: number, cb: ProgressCallback): void; /** * End updater. */ end(): void; /** * Update callback. */ update(): void; }