Abandon seajs, go to requirejs, and discard seajsrequirejs

Source: Internet
Author: User
Tags node server

Abandon seajs, go to requirejs, and discard seajsrequirejs

[Preface]

This article is written from the beginner's point of view. Don't touch it. There is no bias in your personal thoughts.


[Painful seajs]

As I said before, if I want to try seajs six months ago, it has never been used for various reasons,

I used it for a week recently. It's basically getting started. At first, I felt that this kind of js management method was good,

But then I started to promote it to the project.


[Chinese heart is supported, helpless]

Idle,

There is a heart that supports domestic products. We have previously considered the background ui framework. The first choice is dwz,

I tried to handle all kinds of bugs and bad documents,

Finally, change easyui to powerful functions, sound documentation, and sound examples.


[Successful framework]

In my opinion, a successful framework, whether it is the frontend or backend, requires the following:

1. Powerful functions

2. Detailed documentation (api)

3. Enough demos

4. Short learning curve

5. It is best to have an active community.


It should be said that the first four points are important and necessary.


[Look at seajs again]

1. Powerful functions

This is OK

But it is a bit painful, that is, the cmd specification,

It means that every js needs to be cmd,

It means that cmd is required to use jquery,

Some people say this is simple. Directly download the cmd jquery file from spm,

But what if you want to use bootstrap and use metro ui css? What about other plug-ins?

Search for bootstrap on spm, there are only three, and it cannot be determined which one is official. Isn't this js so scared?

What if spm does not exist? Manual Encapsulation by yourself, so depressing. Using seajs to manage js is originally intended to be simple, rather than looking for things to do.


2. Detailed documentation

Seajs is a domestic product, but it is speechless. The author has a foreign heart,

Brother, your document ........

All the documents on the official website go to github's issue,

What will happen if you sort it out and put it on the official website? What will happen if you make a pdf ????

And,

Add jquery with seajs for the first time,

The example on the official website is normal after being downloaded,

I wrote it myself and used my jquery. I always reported an error, omg,

Do you know how long the problem has been solved ??????

Adding a reademe in your demo will die. You won't say that your jquery is encapsulated by cmd ???

The official website does not exist. github does not have a clear answer. Baidu haystack found the answer.

Speechless...


3. Enough demos

No, it's tears.


4. Short learning curve

In view of the two or three points, we can only say that the curve is not short ,...........


[Comparison with requirejs]

1. Powerful functions

OK. Either seajs or seajs.


2. Detailed documentation (api)

Go to the official website and check your hands. I can understand the poor English.


3. Enough demos

There are a lot of demos. jquery has a corresponding demo directly. Add detailed notes !!!!!!!!


4. Short learning curve

To sum up


5. It is best to have an active community.


[Unable to vomit]

This is always the case in Chinese and Made in China. I have to say, what is the reason? The technology should not be inferior to that in other countries. What is important is some details.

Use requirejs decisively


[Welcome comment]

At the beginning, I wrote it from the beginner's point of view. You are welcome to comment and correct it.


What do you think about seajs and requirejs?

I personally recommend that you use require. js. You do not need to understand every attribute or method of require. If your project is not large, the most basic solution can be solved.
 
Which of the following is the best choice for LABjs, RequireJS, and SeaJS? Why?

LABjs implements these two features through the elegant syntax (script and wait). Its core value is performance optimization. LABjs is a file loader.
RequireJS and SeaJS are module loaders and advocate a modular development concept. The core value is to make JavaScript modular development easier and more natural.
Generally, the module loader can be downgraded to a file loader. Therefore, you can use RequireJS and SeaJS to achieve LABjs performance optimization.
Both RequireJS and SeaJS are good module loaders. The differences between the two are as follows:
1. There are differences between the two. RequireJS wants to be a browser-side module loader and a module loader in environments such as Rhino and Node. SeaJS focuses on the Web browser, and it can be easily run on the Node server through Node extension.
2. There are differences between the two standards. RequireJS follows the AMD (asynchronous module definition) specification, and SeaJS follows the CMD (general module definition) specification. Different Specifications lead to different APIs of the two. SeaJS is more concise and elegant, and is closer to CommonJS Modules/1.1 and Node Modules specifications.
3. There are differences between the two Community concepts. RequireJS is trying to allow a third-party class library to modify itself to support RequireJS. Currently, only a few communities have adopted it. SeaJS does not require strong pushing, but uses self-encapsulated methods to "Haina baichuan". At present, there are mature packaging strategies.
4. There are differences in code quality between the two. RequireJS does not have obvious bugs, and SeaJS does not.
5. The two have different support for debugging. With the plug-in, SeaJS can realize the automatic ing function in Fiddler and realize automatic combo and other functions, which is very convenient and convenient. RequireJS does not support this feature.
6. The plug-in mechanisms of the two are different. RequireJS adopts the form of reserved interfaces in the source code, and the code written for the plug-in is left in the source code. The plug-in mechanism adopted by SeaJS is the same as that of Node: open itself, allowing plug-in developers to directly access or modify it, making it very flexible and implementing various types of plug-ins.
There are still many differences in details.
In short, SeaJS is more concise and elegant from API to implementation than RequireJS. If RequireJS is a Prototype class library, SeaJS is a jQuery class library.
Finally, I would like to pay tribute to RequireJS! RequireJS and SeaJS are good brothers. It is most important to work together to promote modular development ideas.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.