You are reading a single comment by @Gordon and its replies. Click here to read the full conversation.
  • Just got back from a holiday and I have a million e-mails and posts to get through, so sorry for not reading this fully, but this might help:

    • Modules can be used from another module
    • Modules are only 'loaded in' once, even if used multiple times. If you put console.log in the main scope of a module, it will only be called once. But it'll be called right at the start, not when you first do require.
    • If your module is var A = {}; exports.A = A;, every time you require that module you will get access to the same version of A
    • The order of loading should be correct (i think) - that is, if A requires B, B is loaded before A.
    • Modules are executed in their own scope (called module IIRC). If you want to stick stuff in the global scope I think you can still use global, but that's probably frowned upon.
About

Avatar for Gordon @Gordon started