export function retryable < T > ( func , delay ) { return new Promise ( resolve => { const run = ( i ) => { setTimeout ( ( ) => { func ( ) . then ( res => res ) . then ( val => resolve ( val ) ) . catch ( ( ) => run ( i + 1 ) ) ; } , delay * i ) ; } ; run ( 0 ) ; } ) ; }