import { Events , ProgressBar } from "../ProgressBar" ; import { ProgressBarRenderer } from "./ProgressBarRenderer" ; export default class RenderTrigger { constructor ( public readonly render , public readonly bar , public readonly event = Events . TICK ) { } private renderCallback = ( ) => this . render . render ( this . bar ) ; init ( ) { this . bar . addListener ( this . event , this . renderCallback ) ; } finalize ( ) { this . bar . removeListener ( this . event , this . renderCallback ) ; } }