declare let Ennuiboard , ECDefaultHotkeys ; import * as audio from "./audio" ; import * as config from "./config" ; import * as downloadStream from "./download-stream" ; import * as log from "./log" ; import * as net from "./net" ; import * as proc from "./proc" ; import { prot } from "./protocol" ; import * as rtennui from "./rtennui" ; import * as uiImpl from "./ui-impl" ; import * as util from "./util" ; async function main ( ) { await downloadStream . load ( ) ; if ( ! await config . load ( ) ) return ; try { await util . loadLibrary ( "libs/ennuiboard.min.js" ) ; } catch ( ex ) { } if ( typeof Ennuiboard !== "undefined" ) Ennuiboard . enable ( "gamepad" , { auto : true , manualPoll : true } ) ; try { await uiImpl . mkUI ( ) ; ECDefaultHotkeys = { "0000c" : "ecmenu-chat" } ; util . loadLibrary ( "hotkeys.min.js?v=5" ) ; await config . resolve ( ) ; await net . connect ( ) ; proc . localProcessing ( ) ; if ( config . useRTEnnui . audio ) rtennui . initRTEnnui ( ) ; await audio . getAudioPerms ( uiImpl . mkAudioUI ) ; } catch ( ex ) { log . pushStatus ( "error" , ex + "\n\n" + ex . stack ) ; } } main ( ) ; window . onbeforeunload = function ( ) { if ( net . mode === prot . mode . buffering && net . bufferedAmount ( ) ) return "Data is still buffering to the server!" ; } ;