file copyright author Vivek M. Chawla <@VivekMChawla>
 *  version license requires requires summary description import { SfdxFalconResult } from '../sfdx-falcon-result' ; import { Subscriber } from '../sfdx-falcon-types' ; class description version public export class FalconProgressNotifications { method param { string } message param { number } interval param { SfdxFalconResult } result param { Subscriber } observer returns { NodeJS . Timeout } description public static public static start ( message , interval , result , observer ) { if ( typeof FalconProgressNotifications . timeoutRefs === 'undefined' ) { FalconProgressNotifications . timeoutRefs = new Array ( ) ; } const timeoutRef = setInterval ( progressNotification , interval , result , message , observer ) ; FalconProgressNotifications . timeoutRefs . push ( timeoutRef ) ; return timeoutRef ; } method param { NodeJS . Timeout } timeoutObj returns { void } description public static public static finish ( timeoutObj ) { if ( timeoutObj ) { clearInterval ( timeoutObj ) ; } } method returns { void } description public static public static killAll ( ) { if ( typeof FalconProgressNotifications . timeoutRefs !== 'undefined' ) { for ( const timeoutRef of FalconProgressNotifications . timeoutRefs ) { clearInterval ( timeoutRef ) ; } } } /** Holds a reference to every timeout object created as part of the SFDX-Falcon notification process. */ private static timeoutRefs : NodeJS . Timeout [ ] ; } function param { SfdxFalconStatus } status param { string } message param { Subscriber } observer returns { void } description private function progressNotification ( result , message , observer ) { updateObserver ( observer , `[${ result . durationString }] ${ message }` ) ; } function param { Subscriber } observer param { string } message returns { void } description export function updateObserver ( observer , message ) { if ( typeof observer !== 'object' ) return ; if ( typeof observer . next !== 'function' ) return ; if ( typeof message !== 'string' ) return ; observer . next ( message ) ; }