3 Replies Latest reply on Nov 2, 2014 1:21 PM by Bruce Bullis

    HTML extensions: Getting values out of callbacks

    myscreennameis_Miles Level 1

      I want to store a value from JSX in JS so I don't have to call evalScript all the time.

      Is there a way to get a value out of a callback like this?

       

              var csInterface = new CSInterface();
           evalout = "lcl";
                
           csInterface.evalScript("$._ext_PPRO.testOnLoadedVar",
           function (result)
                {
                evalout = result;
                console.log("In testcb: evalout:"+evalout);
                console.log("In testcb: result:"+result);
                }
           );
           console.log("evalout: "+evalout);
      

       

      The console output happens before the callback runs, so evalout equals "lcl". I've also tried the function as a named function, but the same thing happens. I think there is something basic that I'm missing.

       

      Thanks,

      Miles