Skip to content

Instantly share code, notes, and snippets.

@Takazudo
Created October 28, 2010 03:40
Show Gist options
  • Save Takazudo/650580 to your computer and use it in GitHub Desktop.
Save Takazudo/650580 to your computer and use it in GitHub Desktop.
RequireJS "define" example
//----------- simply do this like json -----------
define({
color: black,
size: 170
});
//----------- or you can run something in it -----------
define(function(){
var color = doSomethingHere();
var size = doSomethingHere();
return {
color: color,
size: size
};
});
// see http://requirejs.org/docs/api.html#define
require(['hogeModule'], function(data){
console.log(data.color);
console.log(data.size);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment