Asynchronous module definition

Last updated
Instead of loading files one after the other, AMD can load them all separately, even when they are dependent on each other. Asynchronous Module Definition overview vector.svg
Instead of loading files one after the other, AMD can load them all separately, even when they are dependent on each other.

Asynchronous module definition (AMD) is a specification for the programming language JavaScript. It defines an application programming interface (API) that defines code modules and their dependencies, and loads them asynchronously if desired. Implementations of AMD provide the following benefits:

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. For production and deployment, developers can concatenate and minify JavaScript modules based on an AMD API into one file, the same as traditional JavaScript.

AMD provides some CommonJS interoperability. It allows for using a similar exports and require() interface in the code, although its own define() interface is more basal and preferred. [1] Universal module definition (UMD) is a variant paradigm that takes advantage of these commonalities to support both AMD and CommonJS. [2]

The AMD specification is implemented by Dojo Toolkit, RequireJS, and other libraries.

Related Research Articles

JSON is an open standard file format and data interchange format that uses human-readable text to store and transmit data objects consisting of attribute–value pairs and arrays. It is a very common data format, with a diverse range of applications, one example being web applications that communicate with a server.

Dojo Toolkit

Dojo Toolkit is an open-source modular JavaScript library designed to ease the rapid development of cross-platform, JavaScript/Ajax-based applications and web sites. It was started by Alex Russell, Dylan Schiemann, David Schontzler, and others in 2004 and is dual-licensed under the modified BSD license or the Academic Free License.

YUI Library

The Yahoo! User Interface Library (YUI) is a discontinued open-source JavaScript library for building richly interactive web applications using techniques such as Ajax, DHTML, and DOM scripting. YUI includes several core CSS resources. It is available under a BSD License. Development on YUI began in 2005 and Yahoo! properties such as My Yahoo! and the Yahoo! front page began using YUI in the summer of that year. YUI was released for public use in February 2006. It was actively developed by a core team of Yahoo! engineers.

TypeScript is a programming language developed and maintained by Microsoft. It is a strict syntactical superset of JavaScript and adds optional static typing to the language. TypeScript is designed for the development of large applications and transcompiles to JavaScript. As TypeScript is a superset of JavaScript, existing JavaScript programs are also valid TypeScript programs.

OpenSocial Public specification aimed at social networking applications

OpenSocial is a public specification that defines a component hosting environment (container) and a set of common application programming interfaces (APIs) for Web-based applications. Initially, it was designed for social network applications and developed by Google along with MySpace and a number of other social networks. More recently, it has become adopted as a general use runtime environment for allowing untrusted and partially trusted components from third parties to run in an existing web application. The OpenSocial Foundation moved to integrate or support numerous other Open Web technologies. This includes OAuth and OAuth 2.0, Activity Streams, and Portable Contacts, among others.

A single-page application (SPA) is a web application or website that interacts with the user by dynamically rewriting the current web page with new data from the web server, instead of the default method of a web browser loading entire new pages. The goal is faster transitions that make the website feel more like a native app.

Node.js JavaScript runtime environment

Node.js is an open-source, cross-platform, back-end JavaScript runtime environment that runs on the V8 engine and executes JavaScript code outside a web browser. Node.js lets developers use JavaScript to write command line tools and for server-side scripting—running scripts server-side to produce dynamic web page content before the page is sent to the user's web browser. Consequently, Node.js represents a "JavaScript everywhere" paradigm, unifying web-application development around a single programming language, rather than different languages for server-side and client-side scripts.

CommonJS is a project with the goal to establish conventions on the module ecosystem for JavaScript outside of the web browser. The primary reason for its creation was a major lack of commonly accepted forms of JavaScript module units which could be reusable in environments different from that provided by conventional web browsers running JavaScript scripts.

npm (software) JavaScript package manager

npm is a package manager for the JavaScript programming language.

Windows Runtime (WinRT) is a platform-agnostic application architecture first introduced in Windows 8 and Windows Server 2012 in 2012. WinRT supports development in C++/WinRT, C++/CX, Rust/WinRT, JavaScript-TypeScript, and the managed code languages C# and Visual Basic .NET (VB.NET). WinRT applications natively support both the x86 and ARM processors, and may run inside a sandboxed environment to allow greater security and stability. WinRT components are designed with interoperability among multiple languages and APIs in mind, including native, managed and scripting languages.

Amber Smalltalk

Amber Smalltalk, formerly named Jtalk, is an implementation of the Smalltalk-80 language that runs on the JavaScript runtime of a web browser. It is designed to enable client-side development using the Smalltalk programming language. The programming environment in Amber is named Helios.

Yeoman is an open source client-side scaffolding tool for web applications. Yeoman runs as a command-line interface written for Node.js and combines several functions into one place, such as generating a starter template, managing dependencies, running unit tests, providing a local development server, and optimizing production code for deployment.

Nim (programming language) Programming language

Nim is an imperative, general-purpose, multi-paradigm, statically typed, systems, compiled programming language designed and developed by Andreas Rumpf. It is designed to be "efficient, expressive, and elegant", supporting metaprogramming, functional, message passing, procedural, and object-oriented programming styles by providing several features such as compile time code generation, algebraic data types, a foreign function interface (FFI) with C, C++, Objective-C, and JavaScript, and supporting compiling to those same languages.

WebAssembly Cross-platform assembly language and bytecode designed for execution in web browsers

WebAssembly is an open standard that defines a portable binary-code format for executable programs, and a corresponding textual assembly language, as well as interfaces for facilitating interactions between such programs and their host environment. The main goal of WebAssembly is to enable high-performance applications on web pages, but the format is designed to be executed and integrated in other environments as well, including standalone ones.

webpack Open-source JavaScript module bundler

webpack is an open-source JavaScript module bundler. It is made primarily for JavaScript, but it can transform front-end assets such as HTML, CSS, and images if the corresponding loaders are included. webpack takes modules with dependencies and generates static assets representing those modules.

NativeScript is an open-source framework to develop mobile apps on the Apple iOS and Android platforms. It was originally conceived and developed by Progress. At the end of 2019 responsibility for the NativeScript project was taken over by long-time Progress partner, nStudio. In December 2020 nStudio also oversaw the induction of NativeScript into OpenJS Foundation as an Incubating Project. NativeScript apps are built using JavaScript, or by using any programming language that transpiles to JavaScript, such as TypeScript. NativeScript supports the Angular and Vue JavaScript frameworks. Mobile applications built with NativeScript result in fully native apps, which use the same APIs as if they were developed in Xcode or Android Studio. Additionally, software developers can re-purpose third-party libraries from CocoaPods, Maven, and npm.js in their mobile applications without the need for wrappers.

gulp is an open-source JavaScript toolkit created by Eric Schoffstall used as a streaming build system in front-end web development.

Grunt is a JavaScript task runner, a tool used to automatically perform frequent tasks such as minification, compilation, unit testing, and linting. It uses a command-line interface to run custom tasks defined in a file. Grunt was created by Ben Alman and is written in Node.js. It is distributed via npm. As of September 2016, there were more than 5,000 plugins available in the Grunt ecosystem.

Deno (software) Secure Javascript and Typescript runtime

Deno is a runtime for JavaScript and TypeScript that is based on the V8 JavaScript engine and the Rust programming language. It was created by Ryan Dahl, original creator of Node.js, and is focused on productivity. It was announced by Dahl in 2018 during his talk "10 Things I Regret About Node.js". Deno explicitly takes on the role of both runtime and package manager within a single executable, rather than requiring a separate package-management program.

AssemblyScript Programming language, variant of TypeScript that compiles to WebAssembly

AssemblyScript is a TypeScript-based programming language that is optimized for WebAssembly and compiled to WebAssembly using asc, the reference AssemblyScript compiler. It is developed by the AssemblyScript Project and the AssemblyScript community.

References

  1. "AMD specification". GitHub. Group for AMD JS Module API. 28 October 2019. Retrieved 28 October 2019.
  2. "Universal Module Definition". GitHub. 28 October 2019.