//自定义事件
function Event() {

    var handles = [];

    //绑定事件
    this.addHandle=function(fn) {
        handles.push(fn);
    }

    //触发事件
    this.exec = function () {
        if (handles.length > 0) {
            handles.forEach(function (value, index, array) {
                value();
            });
        }
            
    }
}

 

 posted on 2016-08-01 19:24  Just_Do  阅读(164)  评论(0)    收藏  举报