Using the Module Pattern for larger projects

前端 未结 3 1457
小蘑菇
小蘑菇 2021-02-18 23:49

I\'m interested in using the Module Pattern to better organize my future projects. Unfortunately, there are only a few brief tutorials and proof-of-concept examples of the Modul

3条回答
  •  天命终不由人
    2021-02-19 00:07

    There are a lot of nuances to how people prefer to do that, but the main benefit of what you're calling the module pattern (a named scope), is that your not cluttering up the global namespace, which helps keep things clean if you bring in other libraries etc, and avoids name collisions.

    How you organize the names and nested scopes within that is largely a matter of personal preference.

提交回复
热议问题