export function timeoutPromiseAfter < T , G > ( future , ms , onTimeout ) { return new Promise ( ( resolve , reject ) => { setTimeout ( ( ) => reject ( onTimeout ( ) ) , ms ) ; future . then ( resolve ) . catch ( reject ) ; } ) ; }