public
Created

ECMAScript.Next Modules

  • Download Gist
ecmascript.next_modules.js
JavaScript
1 2 3 4 5 6 7 8 9 10 11 12 13
// 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!'); }
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.