constructor param { function } callback export class Tick { frameId : number | undefined = undefined ; isRun : boolean = true ; constructor ( public callback ? ) { } start ( ) { const frame = ( ) => { if ( ! this . isRun ) return ; this . frameId = requestAnimationFrame ( frame ) ; this . callback ?. ( ) ; } ; frame ( ) ; } destroy ( ) { if ( typeof this . frameId === "number" ) { cancelAnimationFrame ( this . frameId ) ; } this . isRun = false ; } }