1 Reply Latest reply on Nov 22, 2016 10:32 AM by Loic.Aigon

    How to debug inside evalScript

    rollwhistler

      Hi,

       

      I have an html5 extension working, I can break point on my code and debug really nicely with chrome remotely.

       

      But I don't know how to debug the functions inside my jsx file, those I call using evalScript. I'm loading them using the manifest.xml <ScriptPath>, and it is being loaded correctly since if I change my functions to do something simple like app.documents.add(), it works.

       

      So... can I find that jsx file from my chrome devtools? or how am I supposed to debug that file?

       

      Thank you!

        • 1. Re: How to debug inside evalScript
          Loic.Aigon Adobe Community Professional

          If it's just about sending a possible jsx script execution error, you may want to use the basic callback mechanism

           

          HTML

           var csInterface = new CSInterface(); 
          csInterface.evalScript('app.documents.add();', function(result){ 
          console.log(result); 
          }); 
          

           

          JSX

          function myJSXScript() {
            try {
            doc.name; //should throw an error
            return "ok";
            }
            catch(err) {
            return err.line+"//"+err.message;
            }
          }
          

           

          If you have many elemnts to log, you can use events

          HTML

           var csInterface = new CSInterface(); 
          csInterface.addEventListener("jsxLog", function(event){ 
               console.log('JSX Message:' + event.data); 
          }); 
          

           

          JSX

          function myJSXScript() {
            log( "So far so good" );
            log( "Still going" );
            log( "Well all fine" );
          }
          
          
          function log ( msg ) {
            var externalObjectName = "PlugPlugExternalObject";
            try {
            var mylib = new ExternalObject( "lib:" + externalObjectName );
            var eventObj = new CSXSEvent();
            eventObj.type = "jsxLog";
            eventObj.data = msg;
            eventObj.dispatch();
            }
            catch(err){}
            }
          }
          

           

           

          HTH

           

          Loic

          1 person found this helpful