umd
(function(root,factory){
// 作用:webpack z支持 amd cmd umd
if(typeof exports ==='Objedct'){
module.exports = factory() ;// common.js环境个下返回值
}else if(typeof define === 'function'){
define(factory); // defie(function(){return;'a'}) AMD
}else{
window.eventUtil = factory()
}
})(this,function(){
// 这个回调函数 完成webpack 模块化
// module
return{
// 具体的模块 代码
addEvent:function(el,type,handle){
// ....
},
removeEvent:function(el,type,handle){
// ...
}
}
})