Skip to main content
1 of 2
konijn
  • 33.8k
  • 5
  • 69
  • 264

You could consider using https://developer.mozilla.org/en-US/docs/Glossary/IIFE#avoid_polluting_the_global_namespace

Your shared JS would be an IIFE that you call with a config object like

<script>
    initializeMapLogic({
      bgLayerName : '@Model.DefaultBackgroundLayer',
      infoLayerName : '@Model.DefaultInformationLayer',
      onlyEnablePolygon : true,
      allowMultiplePolygons : true
    });
</script>
konijn
  • 33.8k
  • 5
  • 69
  • 264