import Scheduler from './Scheduler' ; /**
 * [[IntervalScheduler]] calls the callback every intervalMs milliseconds.
 */ export default class IntervalScheduler implements Scheduler { timer : undefined | ReturnType < typeof setInterval > ; constructor ( private intervalMs ) { } start ( callback ) { this . stop ( ) ; this . timer = setInterval ( callback , this . intervalMs ) ; } stop ( ) { if ( this . timer === undefined ) { return ; } clearInterval ( this . timer ) ; this . timer = undefined ; } running ( ) { return this . timer !== undefined ; } }