12.11.2014

Modular JavaScript

On our company website, as on many others, we have a growing JavaScript code base. We are now taking the effort to develop a module system to make it easier to structure the code.

Our first decision was to go with a syntax similar to Asynchronuous Module Definition (AMD). But in contrast to AMD syntax, we use a synchronuous approach for loading the modules and use a module identifier. We will also provide the option to initialize modules on an event.

While implementation is still ongoing, I already enjoy the benefit of a much more organised way to use JavaScript. And I am looking forward to the upcoming standard ECMA 6, which will provide module imports and exports as core language features (see Modules).