export interface ProgressReporter { isEnabled ( data ) : boolean ; begin ( ) : void ; report ( message ) : void ; end ( ) : void ; } export class ProgressReportTracker implements ProgressReporter { private _isDisplayingProgress = false ; constructor ( private _reporter ) { } isEnabled ( data ) { if ( this . _isDisplayingProgress ) { return true ; } return this . _reporter . isEnabled ( data ) ?? false ; } begin ( ) { if ( this . _isDisplayingProgress ) { return ; } this . _isDisplayingProgress = true ; this . _reporter . begin ( ) ; } report ( message ) { if ( ! this . _isDisplayingProgress ) { return ; } this . _reporter . report ( message ) ; } end ( ) { if ( ! this . _isDisplayingProgress ) { return ; } this . _isDisplayingProgress = false ; this . _reporter . end ( ) ; } }