模块 hilo/core/Class
源码
Class.js
Class是提供类的创建的辅助工具。
创建类示例:
var Bird = Hilo.Class.create({ Extends: Animal, Mixes: EventMixin, constructor: function(name){ this.name = name; }, fly: function(){ console.log('I am flying'); }, Statics: { isBird: function(bird){ return bird instanceof Bird; } } }); var swallow = new Bird('swallow'); swallow.fly(); Bird.isBird(swallow);
方法 | 定义于 | |
---|---|---|
create(properties:Object):Object
static
根据参数指定的属性和方法创建类。
|
Class | |
mix(target:Object, source:Object):Object
static
混入属性或方法。
|
Class |