Seajs Simple to use

Source: Internet
Author: User

seajs:http://seajs.org/

Mainly solve the problem of modularization and file dependence.

Take the official website example Hello for example:

Project Catalog:

The app stores the program files, sea-modules store Seajs, jquery and other library files.

1. Define Module--define

// Spinning.js define (function(require, exports, module) {    // Export Object });

Or

// Spinning.js define (function(require, exports, module) {    exports.spinningfunction/ / or Exports object, then use the Ooxx method });

2. File Dependent--require

The following corresponds to the above one by one.

// Main.js define (function(require) {    var Spinning = require ('./spinning ');     var New Spinning (' #container ');    S.render ();});

Or

// Main.js define (function(require) {    var s= require ('./spinning ');    S.render ();});

3. Using--use

Seajs.use ('.. /app/js/main.js ');

Details: http://seajs.org/docs/#docs

Seajs Simple to use

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.