Skip to content

Instantly share code, notes, and snippets.

@nnance
Created September 16, 2014 22:14
Show Gist options
  • Save nnance/5ef7619bb552e51187a8 to your computer and use it in GitHub Desktop.
Save nnance/5ef7619bb552e51187a8 to your computer and use it in GitHub Desktop.
AMD Module With Dynamic Dependencies
define(function ( require ) {
var isReady = false, foobar;
// note the inline require within our module definition
require(['foo', 'bar'], function (foo, bar) {
isReady = true;
foobar = foo() + bar();
});
// we can still return a module
return {
isReady: isReady,
foobar: foobar
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment