zippycli
Version:
An unofficial Zippyshare CLI
105 lines (104 loc) • 1.96 kB
TypeScript
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.
*/
export declare class Progress extends Object {
/**
* Total amount.
*/
protected _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;
/**
* Create Progress.
*
* @param total Total progress.
* @param current Starting progress.
*/
constructor(total: number, current?: number);
/**
* Get the current time.
*
* @returns Current time.
*/
now(): number;
/**
* Add to current amount.
*
* @param amount Amount to be added.
*/
add(amount: number): void;
/**
* Start updater.
*
* @param interval Update interval in milliseconds.
* @param cb Progress callback.
*/
start(interval: number, cb: ProgressCallback): void;
/**
* End updater.
*/
end(): void;
/**
* Update callback.
*/
update(): void;
}