Hello I have the following code:
function outer() {
    try {
        ScriptLoader.getScripts('proj4script',proj4Callback);
    }
    catch(e) {console.log(e);}
    function proj4Callback() {
        x = proj4(some geo coord calcs here);
    }
    // I need access to the values stored in x here
}
As you can see from the code I load the proj4 script into my enviroment using a Scriptloader. Unfortunately this script loader has no return value. One of the arguments to the scriptloader is a callback function - this function can take no parameters.
I am trying to access data that I calculate intoside the callback function in my outer function. Is there a way for me to do this that does not involve using a global variable outside the outer function?
edits:
@Trinot I am not sure what you mean by continuing the asynchronous call pattern, do you mean like this:
function main() {
    x = await new Promise(outer());
}
async function outer().then({
    await new Promise(ScriptLoader.getScripts.bind(ScriptLoader, 'proj4script'));
    let x = proj4(/*some geo coord calcs here*/);
    return x;
})
 
     
    