lianqin7 / base

Base Class

Home Page:aralejs.org/base/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Base


Build Status Coverage Status

Base 是一个基础类,提供 Class、Events、Attribute 和 Aspect 支持。


使用说明

extend Base.extend(properties)

基于 Base 创建子类。例子:

/* pig.js */
define(function(require, exports, module) {
   var Base = require('base');

   var Pig = Base.extend({
       initialize: function(name) {
           this.name = name;
       },
       talk: function() {
           alert('我是' + this.name);
       }
   });

   module.exports = Pig;
});

具体用法请参考:Class 使用文档

Base 与 Class 的关系

Base 是使用 Class 创建的一个基础类,默认混入了 EventsAttribute 等模块:

/* base.js */
define(function(require) {

    var Class = require('class');
    var Events = require('events');
    var Aspect = require('./aspect');
    var Attribute = require('./attribute');

    var Base = Class.create({
        Implements: [Events, Aspect, Attribute],

        initialize: function(config) {
            ...
        },

        ...
    });

    ...
});

具体用法请参考:

About

Base Class

aralejs.org/base/


Languages

Language:JavaScript 100.0%