Skip to content

Instantly share code, notes, and snippets.

@marlomajor
Forked from rrgayhart/require.markdown
Last active April 15, 2016 15:52
Show Gist options
  • Save marlomajor/31e5217d949e2b564a8d to your computer and use it in GitHub Desktop.
Save marlomajor/31e5217d949e2b564a8d to your computer and use it in GitHub Desktop.
The Concept of Require

When you start working with WebPack for GameTime, you'll notice that you can't just define a variable in one file and find it in another as easily as you can in Rails.

Read Node.js, Require and Exports and Organize Your Code with RequireJS

Fork this gist and answer the following questions:

  • In the context of Node, what is a module? -- A module is a part of an application that has a specific purpose. You can write an entire application in one module, or you can break a small application into many modules for better organization and readability.
  • The code examples from the second blog post look very different from the first. Why?
  • Well they are obviously using a different text editor...;) but besides that, the code from the second sample is using require() instead of define in order to wrap the code. Require() gets passed list of dependencies and a function is executed when the dependencies are complete.
@marlomajor
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment