So I am including certain library like this
var start = function() { ... }
var loadScript = function() {
script = document.createElement('script');
script.type = 'text/javascript';
script.src = 'https://whatever.com/js?callback=start';
document.body.appendChild(script)
}
window.onload = loadScript;
As you see, I set a function called "start" as callback for the library. The trouble is that if I minify the file, the function isn't called start anymore.
I tried this, but it does not work.
script.src = 'https://whatever.com/js?callback=' + start.name;
How can I programatically add the name of the function to the src attribute?
EDIT
I am using Rails 4, and the assets are in Coffeescript, so I do not think I can use named function declarations.
start.name?