xudafeng / understand

a MV* framework you could understand in a moment

Home Page:https://xudafeng.github.com/understand

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

UnderStand.js

MV* framework you could understand in a moment

抽象模型:

  • 1.基类扩展
understand.extend({
  fun1:function(){
    console.log('基类扩展');
  }
});
var Module = U.create();
var i = new Module();
i.fun1();
  • 2.创建模型
U.extend({
    fun1:function(){
        console.log('func1 from base create');
    }
})
var Parent = U.create(function(name){
    console.log(name + ' born');
});
Parent.augment({
    fun2:function(){
        console.log('fun2 from method prototype');
    }
});
var Child = Parent.create(function(name){
    console.log(name + ' born');
    this.fun2();
});
Child.augment({
    fun3:function(){
        this.fun1();
       // this.fun2();
    }
});
var p = new Parent('parent');
p.fun1();
//p.fun2();
var c = new Child('child');
c.fun3();
  • 3.子类继承
  • 4.静态属性、方法

数据绑定:

var Module = U.create();
  1. get
Module.get(key);
  1. set
Module.get(key, value);
  1. filter
Module.filter(fn);
  1. remove
Module.remove([key | fn]);
  1. all
Module.all(); // return attributes
  1. size
Module.size(); // return attributes size
  1. has
Module.has(key);//return boolean
  1. update
Module.update([key,]fn);

消息分发:

  1. on
  2. emit
  3. detach

通用工具类:

  1. each
  2. extend
  3. clone
  4. trim
  5. typeof

About

a MV* framework you could understand in a moment

https://xudafeng.github.com/understand

License:MIT License


Languages

Language:JavaScript 85.9%Language:HTML 14.1%