import Modernizr from 'modernizr' ; const features = [ 'flexbox' , 'flexwrap' , 'localstorage' ] ; param feature return { boolean } const isSupported = ( feature ) : boolean => { if ( Modernizr [ feature ] ) { return true ; } const element = document . getElementsByClassName ( 'BadBrowser' ) [ 0 ] ; element . className += ' is-open' ; if ( /iPhone|iPad|iPod|Android/i . test ( navigator . userAgent ) ) { element . className += ' is-mobile' ; } console . warn ( `Feature '${ feature }' not supported.` ) ; return false ; } ; document . addEventListener ( 'DOMContentLoaded' , ( ) => { features . every ( isSupported ) ; } ) ;