Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

dependency injection

View common.js
1 2 3 4
var foo = require("foo"),
bar = foo.bar;
 
exports.bar = bar;
View common.js
1 2 3
define(function(require, exports, module) {
// your file contents here
});
View common.js
1 2
require.setCrossDomain("http://example.com/relay.html",
"http://cdn.example.com/relay.html");
View common.js
1 2 3 4 5 6 7 8
// require two modules
require(["requiredModuleOne", "requiredModuleTwo"],
// run this callback when modules are loaded
function(moduleOne, moduletwo) {
// explicitly declare a dependency is available
provide(newModuleName, resultWhenRequired);
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.