Created
April 23, 2011 17:37
-
-
Save jboesch/938812 to your computer and use it in GitHub Desktop.
ECMAScript.Next Modules
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
// 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