export function listenWindow < K extends keyof WindowEventMap > ( event , handler ) { window . addEventListener ( event , handler ) ; return ( ) => { window . removeEventListener < K > ( event , handler ) ; } ; }