export const viewport = window . visualViewport || { addEventListener : self . addEventListener . bind ( self ) , get width ( ) { return self . innerWidth ; } , get height ( ) { return self . innerHeight ; } , } ; function resize ( ) { document . body . style . height = viewport . height + 'px' ; dispatchEvent ( new CustomEvent ( 'screenfit' , { detail : viewport , } ) ) ; } document . addEventListener ( 'DOMContentLoaded' , resize , { once : true , } ) ; viewport . addEventListener ( 'resize' , resize ) ;