param param returns export function wait ( param ? ) { return new Promise ( ( resolve ) => { if ( typeof param === 'number' ) { setTimeout ( resolve , param ) ; } else if ( typeof param === 'function' ) { const timer = setInterval ( ( ) => { if ( param ( ) ) { clearInterval ( timer ) ; resolve ( ) ; } } , 100 ) ; } else { resolve ( ) ; } } ) ; }