HOME

TheInfoList



OR:

Asynchronous module definition (AMD) is a
specification A specification often refers to a set of documented requirements to be satisfied by a material, design, product, or service. A specification is often a type of technical standard. There are different types of technical or engineering specificati ...
for the programming language
JavaScript JavaScript (), often abbreviated as JS, is a programming language and core technology of the World Wide Web, alongside HTML and CSS. Ninety-nine percent of websites use JavaScript on the client side for webpage behavior. Web browsers have ...
. It defines an
application programming interface An application programming interface (API) is a connection between computers or between computer programs. It is a type of software Interface (computing), interface, offering a service to other pieces of software. A document or standard that des ...
(API) that defines code modules and their dependencies, and loads them asynchronously if desired. Implementations of AMD provide the following benefits: * 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. In addition to loading multiple JavaScript files at runtime, AMD implementations allow developers to encapsulate code in smaller, more logically-organized files, in a way similar to other programming languages such as
Java Java is one of the Greater Sunda Islands in Indonesia. It is bordered by the Indian Ocean to the south and the Java Sea (a part of Pacific Ocean) to the north. With a population of 156.9 million people (including Madura) in mid 2024, proje ...
. For production and deployment, developers can
concatenate In formal language theory and computer programming, string concatenation is the operation of joining character strings end-to-end. For example, the concatenation of "snow" and "ball" is "snowball". In certain formalizations of concatenati ...
and minify JavaScript modules based on an AMD API into one file, the same as traditional JavaScript. AMD provides some
CommonJS CommonJS is a project to standardize the module ecosystem for JavaScript outside of web browsers (e.g. on web servers or native desktop applications). CommonJS's specification of how modules should work is widely used today for server-side Jav ...
interoperability. It allows for using a similar and interface in the code, although its own interface is more basal and preferred. The AMD specification is implemented by
Dojo Toolkit Dojo Toolkit (stylized as dōjō toolkit) is an open-source modular JavaScript library (or more specifically JavaScript toolkit) designed to ease the rapid development of cross-platform, JavaScript/ Ajax-based applications and web sites. It was ...
, RequireJS, and other libraries.


References


External links

*
Why AMD? (Require.js)

Dojo Introduction to AMD

Writing Modular JavaScript With AMD, CommonJS & ES Harmony
{{ECMAScript JavaScript Application programming interfaces Web development