export const getEventSourceWindow = ( event ) => { const isWindow = ! ( event . source instanceof MessagePort ) && ! ( event . source instanceof ServiceWorker ) ; if ( isWindow ) { return event . source as Window ; } return null ; } ;