Take the 2-minute tour ×

I'm a lot have read about ES.Next and I'm have question about ES.Next Modules. In this time all JavaScript programmer's write JavaScript libraries in Anonymous functions. Something like jQuery:

(function( window, undefined ) {
    // ...
    window.jQuery = window.$ = jQuery;
})( window );


(function() {
    // ...
}).call( this );

But how all change when JavaScript get's Modules?

// MyLibrary.js
module MyLibrary {
    export function Hello() {
        console.log( 'Hello' );

// Example.js
import Hello from MyLibrary;

Hello(); // Hello

Or Modules too need write in Anonymous functions? How about Global variables? And how all JavaScript coding style change when come ES.Next?

share|improve this question
For detailed information, see wiki.ecmascript.org/doku.php?id=harmony:modules –  Nathan Wall Dec 12 '12 at 6:15

1 Answer 1

In es6 a script is implicitly a module so explicitly declaring a module is not required. Each of the files in this folder are modules and should help demonstrate actual es6 usage patterns. https://github.com/Benvie/continuum/tree/gh-pages/engine/builtins

share|improve this answer
To be useful as a module, however, a ES6 source file would need to contain at least some export declarations, which are not allowed on the toplevel of a script. –  Andreas Rossberg Dec 12 '12 at 19:49

Your Answer


