title: requireJS : How to structure Javascript for an entire site?
body: <p>I have 3000+ lines of javascript that I need to get into a sensible/maintainable structure. I have chosen to use <a href="http://requirejs.org" rel="noreferrer">requireJS</a> as it has been recommend to me by a few people. I have a bunch of variables that are used throughout the application and need to be available everywhere. I also have a bunch of functions that need to be available everywhere. Apart from these two dependencies most of the code can be divided off into their own modules.</p>
  
  <p><strong>I am having trouble understanding how to manage my main variables so that if one module of code makes changes to the variables the rest of the JS modules will see that change.</strong> I think I need to see a few examples that demonstrate how requireJS is intended to work on a larger scale that the examples in the documentation.</p>
  
  <p>If anyone is an experienced requireJS user I would love the hear your tips!</p>