Asynchronous Module Definition (AMD) is a specification of the JavaScript programming language. Defines the application programming interface (API) that defines code modules and their dependencies and loads them asynchronously if desired. AMD implementations offer the following benefits:
- Improving website performance. The AMD implementation loads small JavaScript files only when needed.
- Fewer page errors. AMD implementations allow developers to define dependencies that must be loaded before the module can be implemented, so the module does not attempt to use external code that is not already available.
Instead of loading files one after the other, AMD can load them all separately, even if they are interdependent.
In addition to loading multiple JavaScript files in runtime, AMD’s implementations allow developers to encapsulate code into smaller, more logically organized files, similar to other programming languages such as Java. For production and deployment, developers can add and extract JavaScript modules into a single file, similar to traditional JavaScript, based on the AMD API.
AMD offers some interoperability with CommonJS. It allows the use of look-alike export and require () interfaces in the code, although its own defined interface is more basic and preferred. Universal Module Definition (UMD) is a prototype version that uses these similarities to support both AMD and CommonJS.
The AMD specification is implemented through the Dojo Toolkit, RequireJS, and other libraries.
Other Reads:
What is Accelerated Mobile Pages (AMP)?
What is “AJAX” in terms of web design & development?