/**
 * The controller that maintain the download status
 */ export interface StatusController { readonly total : number ; readonly progress : number ; reset ( progress , total ) : void ; onProgress ( chunkSize , progress ) : void ; } export function createStatusController ( ) { let total = 0 ; let progress = 0 ; const controller = { get total ( ) { return total ; } , get progress ( ) { return progress ; } , reset ( _progress , _total ) { progress = _progress ; total = _total ; } , onProgress ( _ , _progress ) { progress = _progress ; } } ; return controller ; } export function resolveStatusController ( controller ? ) { if ( ! controller ) { return createStatusController ( ) ; } return controller ; }