declare function sscDingus ( el , config ) ; /**
 * Decode the window's hash component as if it were a query string. Return a
 * key--value map.
 */ function decode_hash ( s ) { if ( s [ 0 ] === "#" ) { s = s . slice ( 1 ) ; } let out = { } ; for ( let part of s . split ( '&' ) ) { let [ key , value ] = part . split ( '=' ) ; out [ decodeURIComponent ( key ) ] = decodeURIComponent ( value ) ; } return out ; } /**
 * Log a message to the harness server.
 */ function log ( obj ) { let msg = JSON . stringify ( obj ) ; var req = new XMLHttpRequest ( ) ; req . addEventListener ( 'load' , ( evt ) => { if ( req . readyState === 4 && req . status === 200 ) { let res = JSON . parse ( req . responseText ) ; console . log ( res ) ; if ( res === "done" ) { window . close ( ) ; } } } ) ; req . open ( "GET" , "/log?msg=" + encodeURIComponent ( msg ) ) ; req . send ( ) ; } document . addEventListener ( "DOMContentLoaded" , function ( ) { let base = document . querySelector ( '.sscdingus' ) ; let dingus = sscDingus ( base , { history : false , fpsCallback : ( frames , ms , latencies ) => { log ( { frames , ms , latencies } ) ; } , perfMode : true } ) ; function handle_hash ( ) { let values = decode_hash ( location . hash ) ; let code = values [ 'code' ] ; if ( code ) { dingus . run ( code , 'webgl' ) ; } } window . addEventListener ( 'hashchange' , function ( ) { handle_hash ( ) ; } ) ; handle_hash ( ) ; } ) ;