Subscribe for automatic updates: RSS icon RSS

Login icon Sign in for full access | Help icon Help
Advanced search

Pages: [1]
  Reply  |  Print  
Author Topic: Debugging gICAPI web component with GDC in native rendering  (Read 6724 times)
Huy H.
Posts: 45


« on: May 07, 2020, 05:14:20 pm »

We've been struggling this for quite some time ever since GDC 3.10 upgrade.  It's getting better in GDC 3.20 to allow us to right-click on a web component and select "Open inspector in new window" to bring up the Chrome DevTool.  While it's good to be able to inspect elements and debug some JavaScript functions after the web component has been loaded, we cannot find any way to start JavaScript debugging in any of the gICAPI interface -- gICAPI.onData() for instance. 

In a situation where we need to debug the gICAPI interface, we have been resorting to use GBC running in a browser instead.  In this particular situation, we are having a consistency issue between GBC and GDC, so we really need to debug this while the application is running in GDC.  Anyone has any idea?
Leo S.
Four Js
Posts: 126


« Reply #1 on: May 07, 2020, 07:18:32 pm »

Hi Huy, yeah thats really annoying.
What you could do for now is having 2 js onData functions, the 1st is called while you have no chance to debug and just saves the data in a local js array, the 2nd is your "real" onData function.
If you are in the debugger you call a helper function (in this sample evalData()) to switch between both and feed the saved data to your real function.
Code
  1. var mydata=[];
  2. ...
  3. function saveData(data) {
  4.  mylog("gICAPI.saveData:"+data);
  5.  mydata.push(data);
  6. }
  7.  
  8. function realOnData(data) {
  9.  mylog("gICAPI.onData:"+data);
  10.  input.value=data;
  11. }
  12. //call this in the console once you are in the debugger
  13. function evalData() {
  14.  gICAPI.onData=realOnData;
  15.  for (var i=0;i<mydata.length;i++) {
  16.    realOnData(mydata[i]);
  17.  }
  18. }
  19. ...
  20. onICHostReady =function(version) {
  21.  ...
  22.   gICAPI.onData=saveData;
  23. }
  24.  
I will register a request for easier debugging of the initial calls tomorrow.
HTH and Regards, Leo

* wc_input.zip (3.47 KB - downloaded 716 times.)
Leo S.
Four Js
Posts: 126


« Reply #2 on: May 12, 2020, 10:56:52 pm »

Hi Huy, I registered GDC-04337,
"Have a convenient way to debug the initial phase of a webcomponent".
Could you make use of my technique ?
Huy H.
Posts: 45


« Reply #3 on: May 12, 2020, 11:09:21 pm »

Thanks for the suggestion Leo.  That's what I usually have to do if I wanted to debug the onData() block: save data, then execute the data later using the debug console.
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines