async loadFile(url, json = false){
        let response = await fetch(url);

        if(response.status != 200){
            throw new Error('None 200 response for : ' + url);
        }

        let result = await response.text();

        if(json){
            try{
                result = result.replace(/^\/\/(.*)$/mg,'');
                return JSON.parse(result); 
            }catch(e){
                throw new SyntaxError('Failed to json decode : ' + url);
            }
        }else{
            return result;
        }
    }
/**
     * handles asynchronously loading files. 
     *
     * @param {string} url - the url of the file to load
     * @param {boolean} json - is the response json
     */
handles asynchronously loading files.
@param {string} url - the url of the file to load
@param {boolean} json - is the response json
handles asynchronously loading files . @param { string } url - the url of the file to load @param { boolean } json - is the response json
async loadFile(url, json = false){
        let response = await fetch(url);
        if(response.status != 200){
            throw new Error('None 200 response for : ' + url);
        }
        let result = await response.text();
        if(json){
            try{
                result = result.replace(/^\/\/(.*)$/mg,'');
                return JSON.parse(result); 
            }catch(e){
                throw new SyntaxError('Failed to json decode : ' + url);
            }
        }else{
            return result;
        }
    }
async loadFile ( url , json = false ) { let response = await fetch ( url ) ; if ( response . status != 200 ) { throw new Error ( 'None 200 response for : ' + url ) ; } let result = await response . text ( ) ; if ( json ) { try { result = result . replace ( / ^\/\/(.*)$ / mg , '' ) ; return JSON . parse ( result ) ; } catch ( e ) { throw new SyntaxError ( 'Failed to json decode : ' + url ) ; } } else { return result ; } }
handles asynchronously loading files.
handles asynchronously loading files .