I have a module I'm building and as part of it I need to have some buttons call some javascript. The problem I'm facing is that when they buttons try to make the JS calls I get errors saying that the function is not defined. It looks like the JS minification changing the function names doesn't update the function names in the HTML calls so it breaks things.
I could put the javascript into script tags in the HTML to avoid the problem I'm facing, but that would cause the script to be loaded for each instance of the module rather than only once per page. Is there another way I should be creating these functions/making these calls so that the buttons can call the js functions?