import xs , { Stream } from 'xstream' ; export default function makeWindowEventDriver < K extends keyof WindowEventMap > ( eventType ) { let callback ; return function eventStream ( ) { return xs . create ( { start ( observer ) { callback = ( e ) => observer . next ( e ) ; window . addEventListener ( eventType , callback ) ; } , stop ( ) { window . removeEventListener ( eventType , callback ) ; } , } ) ; } ; }