• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to debug inside evalScript

Explorer ,
Nov 22, 2016 Nov 22, 2016

Copy link to clipboard

Copied

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!

TOPICS
Scripting

Views

1.2K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

People's Champ , Nov 22, 2016 Nov 22, 2016

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.addEventLi

...

Votes

Translate

Translate
People's Champ ,
Nov 22, 2016 Nov 22, 2016

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines