Simplified Example:
// path/to/js/panel.js
$(function(){
var hidePanel = function(){
//hides the panel div
};
});
// path/to/js/another-script.js
$(function(){
hidePanel(); //out of scope MEGA-FAIL
});
As we speak, i have some functions/variables copy-pasted in 2 different files. I was curious whether RequireJS would solve this problem...