export class RenderCompleteListener { private readonly attributeName = 'data-render-complete' ; constructor ( private readonly element ) { this . setup ( ) ; } public destroy = ( ) => { this . element . removeEventListener ( 'renderStart' , this . start ) ; this . element . removeEventListener ( 'renderComplete' , this . complete ) ; } ; public setup = ( ) => { this . element . setAttribute ( this . attributeName , 'false' ) ; this . element . addEventListener ( 'renderStart' , this . start ) ; this . element . addEventListener ( 'renderComplete' , this . complete ) ; } ; public disable = ( ) => { this . element . setAttribute ( this . attributeName , 'disabled' ) ; this . destroy ( ) ; } ; private start = ( ) => { this . element . setAttribute ( this . attributeName , 'false' ) ; return true ; } ; private complete = ( ) => { this . element . setAttribute ( this . attributeName , 'true' ) ; return true ; } ; }