Skip to content

Instantly share code, notes, and snippets.

@ktiedt
Created August 31, 2012 02:21
Show Gist options
  • Save ktiedt/3548011 to your computer and use it in GitHub Desktop.
Save ktiedt/3548011 to your computer and use it in GitHub Desktop.
A common functions AMD example
define([
"some/class1",
"some/class2",
"other/classes"
],fucntion(class1, class2, classes){
return {
myUtility: function(arg1, arg2) { ..... },
myOtherUtil: function(arg2, arg2) { .... },
commonClass2: class2.commonUtil
};
});
/// using commonUtils from the debugger....
require([
"myNS/commonUtils"
],function(commonUtils) {
commonUtils.myUtility("omg", "its not a global");
commonUtils.myOtherUtil("omg, "neither am I");
commonUtils.commonClass2("omg", "I'm actually part of some/class2!");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment