Skip to content

Instantly share code, notes, and snippets.

@jboesch
Created April 23, 2011 17:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jboesch/938812 to your computer and use it in GitHub Desktop.
Save jboesch/938812 to your computer and use it in GitHub Desktop.
ECMAScript.Next Modules
// Current way of doing modules, you have to expose it via a return statement to make it public.
var Thing = (function(){
function getStuff(){ alert('Stuff retrieved!');
return {
getStuff: getStuff
}
})();
// ECMAScript.Next proposal... adding "export" will make functions public.
// I wonder why they didn't just call it "public function".. export sounds like I'm downloading or something. Meh.
module Thing {
export function getStuff(){ alert('Stuff retrieved!'); }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment