5 minutes to get started Sea.js

Source: Internet
Author: User

Why use Sea.js?

Sea.js Simple, natural code writing and organizing methods

Good compatibility

Technology is more mature, the use is more common.

Directory structure:

examples/|--sea-modules Storage Seajs, jquery and other files, which is also the deployment directory of the module |--static storage of each project JS, css file |     |--Hello |     |--Lucky | '--todo '--the app holds HTML and other files |--hello.html |--lucky.html '--todo.html

The module is documented in the page:

in   hello.html   footer, through   script   introduction of   sea.js  , there is a configuration code:

Seajs Simple Configuration Seajs.config ({base: "). /sea-modules/", alias: {" jquery ":" Jquery/jquery/1.10.1/jquery.js "}})//Load ingress module Seajs.use (".. /static/hello/src/main ")

sea.jsAfter the download is complete, the Portal module is loaded automatically.

code module:

This mini-game has two modules spinning.js and main.js follows a unified notation:

All modules are defined by the Define define (function (Require, exports, module) {///via require to introduce a dependent var $ = require (' jquery ');  var Spinning = require ('./spinning '); Externally provided via exports interface exports.dosomething = ...//or through Module.exports provide the entire interface Module.exports = ...});

Above is the Sea.js recommended CMD module writing format.



5 minutes to get started Sea.js

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.