Created
September 16, 2014 22:14
-
-
Save nnance/5ef7619bb552e51187a8 to your computer and use it in GitHub Desktop.
AMD Module With Dynamic Dependencies
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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