Home  >  Article  >  Web Front-end  >  The difference between LABjs, RequireJS and SeaJS_Seajs

The difference between LABjs, RequireJS and SeaJS_Seajs

WBOY
WBOYOriginal
2016-05-16 16:57:221164browse

1. The core of LABjs is LAB (Loading and Blocking): Loading refers to asynchronous parallel loading, and Blocking refers to synchronous waiting for execution. LABjs implements these two features through elegant syntax (script and wait), and its core value is performance optimization. LABjs is a file loader.

2. RequireJS and SeaJS are module loaders, advocating a modular development concept, and their core value is to make modular development of JavaScript easier and more natural. The module loader can also be downgraded to a file loader, so using RequireJS and SeaJS can also achieve the performance optimization purpose of LABjs.

3. RequireJS and SeaJS are both very good module loaders. The differences between the two are as follows:

1. There are differences in the positioning of the two. RequireJS wants to be a module loader on the browser side, but also wants to be a module loader for environments such as Rhino / Node. SeaJS focuses on the web browser side, and can easily run on the Node server side through Node extension
2. The standards followed by the two are different. RequireJS follows the AMD (Asynchronous Module Definition) specification, and SeaJS follows the CMD (Common Module Definition) specification. The difference in specifications leads to different APIs between the two. SeaJS is more concise and elegant, and closer to CommonJS Modules/1.1 and Node Modules specifications.
3. There are differences in the community concepts between the two. RequireJS is trying to let third-party libraries modify themselves to support RequireJS, but currently only a few communities have adopted it. SeaJS does not force it, but adopts its own packaging method to "accommodate all rivers". Currently, there is a relatively mature packaging strategy.
4. There is a difference in code quality between the two. RequireJS has no obvious bugs, and SeaJS has no obvious bugs.
5. The two have different support for debugging. SeaJS can realize the automatic mapping function in Fiddler through plug-ins, and can also realize functions such as automatic combo, which is very convenient and convenient. RequireJS does not support this.
6. There are differences in the plug-in mechanisms between the two. RequireJS takes the form of reserving interfaces in the source code, and the source code contains code written for plug-ins. The plug-in mechanism adopted by SeaJS is consistent with Node's approach: it opens itself up so that plug-in developers can directly access or modify it, making it very flexible and capable of implementing various types of plug-ins.

There are many detailed differences that I won’t go into.

In short, SeaJS is more concise and elegant than RequireJS from API to implementation. If RequireJS is a Prototype class library, then SeaJS is a jQuery class library.
Finally, hats off to RequireJS! RequireJS and SeaJS are good brothers and work together to promote the idea of ​​modular development. This is the most important thing.

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn