Hexagon Geospatial
MENU

Smart M.App

Looking for answers in regards to M.Apps, M.App Exchange or M.App Studio? Smart M.App Tech Discussion board is where you can search, ask your questions and assist others by sharing your knowledge. Join the conversation, connect, contribute and share.
Showing results for 
Search instead for 
Do you mean 
Reply
Technical Evangelist
Posts: 1,106
Registered: ‎09-11-2015
Accepted Solution

Debugging M.App

[ Edited ]

Is there a way of try-and-see test from within a running M.App application in browser? I tried to open Firebug console and run some example code but it claims that $GP is not recognized object name.

 

How to properly debug M.App? Do I need to place a debug code in M.App Studio, Save it and see the results?

 

Thanks,

Jan

Jan Neumann
Post Sales Engineer Web Applications
Hexagon Geospatial

Technical Evangelist
Posts: 132
Registered: ‎08-05-2015

Re: Debugging M.App

Hi Jan,

 

this is a very good question! Currently debugging is supported only via adding 

debugger;

statement inside your customization code, which is of course a little tedious. The reason for that lays in security mechanisms, which require specific headers in the request for the script (so that it cannot be read without authorization to protect your intellectual property) that couldn't be added in a plain GET request like

<script src="{customizationScriptUrl}"></script>

 

The development team is already investigating alternative methods of applying customization code that would make the debugging process easier but would still protect scripts from unauthorized access.

Technical Evangelist
Posts: 1,106
Registered: ‎09-11-2015

Re: Debugging M.App

I see and understand that limitation. Thanks for proposing the alternative Smiley Wink

Jan Neumann
Post Sales Engineer Web Applications
Hexagon Geospatial

Staff
Posts: 4
Registered: ‎04-07-2016

Re: Debugging M.App

When you customize your app you can add following line at the beginning of your custom script:

//@ sourceURL=foo.js


After this when you run your app, you should be able to see your script as:

debug.jpg

 

You should now be able to debug as usual. Works in both Chrome & FF.

Technical Evangelist
Posts: 1,106
Registered: ‎09-11-2015

Re: Debugging M.App

Sorry for the dumb questions but...

  • Do you have to place this script (foo.js) to some remote server?
  • Does it mean that you place all JS code into this script file instead of placing it into JS custom panel?

Thanks

 

Jan Neumann
Post Sales Engineer Web Applications
Hexagon Geospatial

Highlighted
Technical Evangelist
Posts: 132
Registered: ‎08-05-2015

Re: Debugging M.App

Hi Jan,

 

no, no - it is all about creating a comment inside the code that you type in the custom panel with the editor.

Browsers that support that have some special logic that looks for such comments and then are able to present evaluated scripts as if they were coming from a file.

The name "foo.js" is completely arbitrary because it doesn't really matter - it just means that the evaluated code will be presented as if it was coming from the "foo.js" file. Please take a look at this article https://developer.mozilla.org/en-US/docs/Tools/Debugger/How_to/Debug_eval_sources

 

Best regards

Do you need immediate support?
Please submit a Ticket through our
Development Ticket Portal.