Hexagon Geospatial
MENU

Developer Discussions

Discuss topics with other Hexagon Geospatial Power Portfolio developers and experts to get the most out of our products.
Showing results for 
Search instead for 
Do you mean 
Reply
Occasional Contributor
Posts: 12
Registered: ‎05-23-2017
Accepted Solution

Custom.js recommended structure

Is there a recommended structure on how to organize the Custom.js file and related calls to auxiliary functions? Is it better to separate function definitions outside the gsp.ready() main function, or even in separate files?

 

Most examples supplied in the forum/Git are just pieces that I don't know the best approach to tie them.

 

This gets a little more difficult when dealing with multiple custom procedures/functions that need to be called in a specific sequence and need to be arranged within the callback functions of most API methods used (e.g successCallback).

 

I can see some guidelines in this topic, but is there some real example that I can use as reference?

 

Thanks in advance!

Highlighted
Technical Evangelist
Posts: 184
Registered: ‎07-30-2015

Re: Custom.js recommended structure

[ Edited ]

Hi,

 

there isn't, the customization project structure depends on developer needs and habits.

 

On one of the trainings I prepared an "Autograph hunter" app. 

It might be helpful, because it addresses couple of your questions:

  • I separated functionality into AMD modules
  • I prepared a simple adapter that lifts callback based functions from the API to promise like functions

 

If you don't have it I'll send it to you.

Occasional Contributor
Posts: 12
Registered: ‎05-23-2017

Re: Custom.js recommended structure

Hi Lukasz,

 

I'd appreciate if you could share it.

 

Thanks!

Polls
Please register to vote
Do you need immediate support?
Please submit a Ticket through our
Development Ticket Portal.