3 Replies Latest reply on Jan 27, 2017 11:03 AM by tusharde

    Getting data from JSX and store in the global JS scope?

    Heimdaal Level 1

      I'm developing a HTML5 panel for Photoshop and I have a problem.

      I'm using CSInterface.evalScript() to call my JSX function - which returns a bunch of values.

      The return is then handled by a function that resides as the second parameter to evalScript() - so far nothing strange (code example below).

       

      var csInterface = new CSInterface();
      
      var lolk = 10;
      
      csInterface.evalScript("myJSX('param1')", function(result){
          lolk = result[8];
      });
      alert(lolk); // gives 10 - not the value returned from myJSX
      

       

      The problem here is that I really, really need to be able to output things into the global scope in main.js. But with the above code you will not overwrite the global variable lolk. Instead the assignment is only within the scope of evalScript.