What are the Seajs and their pros & cons and how to use them?

Source: Internet
Author: User
Tags definition require
This article mainly introduced SEAJS knowledge and learning experience, suitable for just contact Seajs classmate, need friends can refer to, have better novice tutorials or documents, welcome to recommend, Share!

1. Seajs IntroductionSeajs, a Web module loading framework, the pursuit of simple, natural code writing and organization,: Sea.js Follow the CMD specification, modular JS code.   Relying on automatic loading, simple and clear configuration, allows programmers to focus more on coding. 2. Seajs Advantages and disadvantagesAdvantages: 1. Improve maintainability. (2). Modular programming. 3. Dynamic loading, front-end performance optimization disadvantages: 1. Learning less and confusing documents will change the writing habits of the team using JS, and you must use modular programming. 2). Not very suitable for the current situation of the team, more JS file but less changes, dynamic loading advantages and modularity advantage is not obvious.   3. Need to support the use of SPM tools, JS packaging and management tools. 2. what is cmd and AMD? Asynchronous module definition (AMD) is the abbreviation of Asynchronous module definition, and it is the normalized output of requirejs in the process of generalization. Universal module definition (CMD) is the abbreviation of Common module definition, and it is the normalized output of seajs in the process of generalization.   Both Requirejs and SEAJS are representatives of modular frameworks, AMD and CMD, which are their respective ways of defining modularity, the same as the code style and API. 3. Seajs How to use

A piece of code to teach novice at a glance, Quick start!
The code is as follows: <script src= ". /js/examples-master/sea-modules/seajs/seajs/2.1.1/sea.js "></script>
<script>//Configure JS path Seajs.config ({alias:{"jquery": ".      /examples-master/sea-modules/jquery/jquery/1.10.1/jquery.js "}}); Load module Seajs.use (' ....     /js/seajs/init ', function ($) {$ ("#test_div"). Click (function () {alert (1);}); });     </script> code as follows://init.js define (function (Require,exports,module) {var $ = require (' jquery '); return $; });
Seajs is so simple, quick to learn it!



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.