Skip to content

Instantly share code, notes, and snippets.

@tuvokki
tuvokki / gist:7080280
Created October 21, 2013 08:11
AMD: Basic principle; You don't create any global variables. Not even a 'Whatever' namespace. Instead, you explicitly export any variables you want to expose to the AMD framework. On the other hand, when you need a dependency, you tell the AMD framework. The AMD framework then takes care of supplying that dependency to you. It is a bit like OSGi…
/*
Have a look at these links:
https://github.com/amdjs/amdjs-api/wiki/AMD
http://requirejs.org/docs/whyamd.html
EXAMPLE:
*/
define('moduleA', [ /* no dependencies */ ], function() {
// Here we are inside the callback function body. This is called by AMD.