shared configurations and functions

464
4
Jump to solution
10-05-2018 01:11 PM
ZorbaConlen1
Occasional Contributor III

Hi,

This is a general, best practices question.

What is the best approach to sharing configurations between widgets? Let's say I have some configurations that several widgets need to access. Instead of repeating the configurations in each widgets own config.json file, it seems better to place them in a shared or common config.json file.

Likewise for utility type functions that could be used by multiple widgets. Is there an approach others have used for this?

Thanks

0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus

Zorba,

   The one option for that would be to add that function to one of the js files that always gets added when using the app like MapManager.js or configloader.js that way you can call MapManager.getInstance().yourFunctionName()

View solution in original post

0 Kudos
4 Replies
RobertScheitlin__GISP
MVP Emeritus

I would add it to the apps main config file each widget has access to the this.appConfig variable. 

0 Kudos
ZorbaConlen1
Occasional Contributor III

Thanks Robert. Sounds good.

What about the second part of my question? What if you have several widgets that can use the same function. Is there a standard way to handle that. I'd like to avoid redundantly adding that same function to each widget.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Zorba,

   The one option for that would be to add that function to one of the js files that always gets added when using the app like MapManager.js or configloader.js that way you can call MapManager.getInstance().yourFunctionName()

0 Kudos
ZorbaConlen1
Occasional Contributor III

Great. Thanks for the suggestion.

0 Kudos