import { enableLogger , loadModule } from '../../src/index' ; enableLogger ( console . log . bind ( console ) ) ; const init = async ( ) => { try { const cldFactory = await loadModule ( ) ; ( window as any ) . cld = cldFactory . create ( 10 , 1000 ) ; } catch ( e ) { console . log ( `failed to load cld library` , e ) ; } } ; init ( ) ; const postDOMSetup = ( ) => { if ( ! window || ! window . location || ! window . document || ! window . document . body ) { setTimeout ( postDOMSetup , 250 ) ; return ; } document . body . addEventListener ( 'input' , ( evt ) => { if ( ! ! evt . target && ! ! ( evt . target as any ) . value ) { const v = ( evt . target as any ) . value ; if ( v . length < 10 ) { return ; } const start = performance . now ( ) ; const result = ( window as any ) . cld . findLanguage ( v ) ; const time = performance . now ( ) - start ; console . log ( `findLanguage: ${ v } took ${ time }ms, length ${ v . length }` , result ) ; } } ) ; } ; setTimeout ( postDOMSetup , 250 ) ;