import { INPUT_QUERY , SUGGESTION_QUERY } from './constants' ; import { Opelete } from './Opelete' ; ( ( ) : void => { const { pathname } = window . location ; if ( pathname !== '/' && pathname !== '/search' ) { return ; } const mo = new MutationObserver ( ( _ , self ) => { const inputNode = document . querySelector ( INPUT_QUERY ) as HTMLInputElement ; const suggestionNode = document . querySelector ( SUGGESTION_QUERY ) as HTMLDivElement ; if ( inputNode && suggestionNode ) { self . disconnect ( ) ; new Opelete ( inputNode , suggestionNode ) ; } } ) ; mo . observe ( document . body , { childList : true } ) ; } ) ( ) ;