Notorious Penguin Magicians
    Wondering what’s next for npm?Check out our public roadmap! »

    understand

    1.0.3 • Public • Published

    UnderStand.js

    MV* framework you could understand in a moment

    抽象模型:

    • 1.基类扩展
        understand.extend({
            fun1:function(){
                console.log('基类扩展)
            }
        });
        var Module = U.class();
        var i = new Module();
        i.fun1();
    • 2.创建模型
        U.extend({
            fun1:function(){
                console.log('func1 from base class');
            }
        })
        var Parent = U.class(function(name){
            console.log(name + ' born');
        });
        Parent.augment({
            fun2:function(){
                console.log('fun2 from method prototype');
            }
        });
        var Child = Parent.class(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.class();
    1. get
       Module.get(key);
    1. set
       Module.get(key, value);
    1. filter
       Module.filter(fn);
    1. delete
       Module.delete([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

    Install

    npm i understand

    DownloadsWeekly Downloads

    10

    Version

    1.0.3

    License

    MIT

    Last publish

    Collaborators

    • avatar