闭包组件

(function(document){
var viewport;
var obj = {
init:function(id){
viewport = document.querySelector("#"+id);
},
addChild:function(child){
viewport.appendChild(child);
},
removeChild:function(child){
viewport.removeChild(child);
}
}
window.jView = obj;
})(document);

转载于:https://www.cnblogs.com/jayruan/p/5460421.html

你可能感兴趣的:(闭包组件)