Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

RequireJS vs Dojo 1.7 AMD

Bit of an abstract question, but I'm surprised I'm not finding it already:

Now that Dojo has gone all AMD with 1.7, How does it compare to RequireJS, Lab, Head, etc...

Edit: I realize lab and head aren't AMD loaders. To clarify:

I'm liking how Dojo is splitting it's core out into small, concise, single-purpose modules. (I'd assume these module would work with any AMD loader now, though I haven't tested that) This leaves dojo.js itself barely more than an AMD loader.

So the question is: As an AMD loader, how does Dojo stack up. In terms of how well if follows the spec, speed, size, efficiency, whatever. It's the new kid in a very heated topic it seems, but I've heard surprisingly little about it.

like image 552
nicholas Avatar asked Mar 30 '12 18:03

nicholas


People also ask

What is RequireJS AMD?

Advertisements. A module in RequireJS is a scoped object and is not available in the global namespace. Hence, global namespace will not be polluted. RequireJS syntax allows to load modules faster without worrying about keeping track of the order of dependencies.

What is AMD in Dojo?

The Asynchronous Module Definition (AMD) format is the module format that Dojo adopted starting with Dojo 1.7. It provides many enhancements over the legacy Dojo module style, including fully asynchronous operation, true package portability, better dependency management, and improved debugging support.

Why do we need RequireJS?

RequireJS is a JavaScript library and file loader which manages the dependencies between JavaScript files and in modular programming. It also helps to improve the speed and quality of the code.

What is Dojo loader?

Dojo was among the first JavaScript libraries to define a module API and publish a loader and build application to solve all of these problems. The original API included the functions dojo. require (request a module), dojo. provide (define a module), and other supporting functions.


1 Answers

4 different things.

Dojo is a toolkit which has been converted to use AMD and ships with an implementation of an AMD loader and optimization tools. requirejs is a loader which also implements AMD and may be used with various toolkits (Dojo support is still lacking) There are some other AMD implementations like curl.js. I don't believe lab.js or head.js implement AMD

If you're asking how the AMD implementations differ or how consistent the spec is... excellent question. If you're asking about the pros and cons of an AMD implementation vs non-AMD, that requires a different matrix. One such comparison can be found on SO.

like image 178
peller Avatar answered Sep 23 '22 03:09

peller