export function tick ( { hz , seed = 0 } ) { if ( hz <= 0 || hz > 1000 ) { throw new Error ( `Unable to set Hertz value of ${ hz }. Must be between 0.1e13 and 1000` ) ; } let frameId = seed || 0 ; return function queue ( params , routineEmitter ) : Queue { let timer = null ; function _step ( ) { frameId ++ ; routineEmitter . emit ( 'runQueue' , { frameId } ) ; } function add ( ) { if ( timer === null ) timer = setInterval ( _step , 1000 / hz ) ; } return { add , flush : _step , emitter : routineEmitter } ; } ; }