import Scheduler from './Scheduler' ; /**
 * [[TimeoutScheduler]] calls the callback once after timeoutMs milliseconds.
 */ export default class TimeoutScheduler implements Scheduler { private timer : any = null ; constructor ( private timeoutMs ) { } start ( callback ) { this . stop ( ) ; this . timer = setTimeout ( ( ) => { clearTimeout ( this . timer ) ; callback ( ) ; } , this . timeoutMs ) ; } stop ( ) { if ( this . timer !== null ) { clearTimeout ( this . timer ) ; this . timer = null ; } } }