Seajs extending public methods through Module.constructor.prototype

Source: Internet
Author: User

I looked at it again. Example of application of module parameters in extension seajs modules definition very good! Try it yourself!

http://limu.iteye.com/blog/1136712

Https://github.com/seajs/seajs/issues/67

In order to be able to preload the public part module! Use the Preload module function provided by Sea.js!

After installing the official Project tool SPM, the direct SPM Install-g Seajs-preload

<! DOCTYPE html>

Common modules section, imitating the HTML method of Jqery

Define (function (Require, exports, module) {var MP = MODULE.CONSTRUCTOR.PROTOTYPE;MP.MJQ = function () {var elem; (function (args) {if (typeof args[0] = = = ' String ') {Elem = document.getElementById (Args[0]);}}) (arguments); var mjquery = (function () {return elem;})  (); mjquery.html = function () {if (typeof Elem = = ' object ' && typeof arguments[0]! = ' undefined ') {elem.innerhtml = Arguments[0];} else {return elem.innerhtml;}} return mjquery;};});

Called in other modules

Define (function (Require, exports, module) {var $ = Module.mjq;console.log ($ ("block"). html ()); $ ("block"). HTML ("Halo") ;});


Seajs extending public methods through Module.constructor.prototype

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.