Skip to content
reyou edited this page Jun 8, 2018 · 2 revisions

Asynchronous module definition (AMD) is a specification for the programming language JavaScript. It defines an application programming interface (API) that defines code module and their dependencies, and loads them asynchronously if desired. https://en.wikipedia.org/wiki/Asynchronous_module_definition

  • Website performance improvements. AMD implementations load smaller JavaScript files, and then only when they are needed.
  • Fewer page errors. AMD implementations allow developers to define dependencies that must load before a module is executed, so the module does not try to use outside code that is not available yet.

Some examples: https://github.com/amdjs/amdjs-api/wiki/AMD

AMD / RequireJS SimpleModule.js http://www.typescriptlang.org/docs/handbook/modules.html

define(["require", "exports", "./mod"], function (require, exports, mod_1) {
    exports.t = mod_1.something + 1;
});
Clone this wiki locally