EXT的addListener,Ext.on做了些什么?
来源:学生作业帮 编辑:大师作文网作业帮 分类:综合作业 时间:2024/11/16 11:18:33
EXT的addListener,Ext.on做了些什么?
Event=function(){varlisteners=[];//用来保存许多 监听 器的数组,每一行包含这4个:el,eventName,fn,wrappedFn,wrappedFn指的是将fn进行一个封装
addListener:function(el,
eventName,fn){el=Ext.
getDom(el);if(!el|| !fn){returnfalse;}if("unload"==eventName){
unloadListeners[unloadListeners.
length]=[el,
eventName,fn];returntrue;}
// prevent unload errors with simple checkvarwrappedFn=function(e){returntypeofExt!='undefined'?fn(Ext.
lib.
Event.
getEvent(e)):false;};varli=[el,
eventName,fn,
wrappedFn];varindex=listeners.
length;listeners[index]=li;//将这4个东东保存进数组this.
doAdd(el,
eventName,
wrappedFn,
false);
addEventListener){returnfunction(el,
eventName,fn,
capture){el.
addEventListener(eventName,fn,(capture));};//那个函数在这里,这是FF的}elseif(window.
attachEvent){returnfunction(el,
eventName,fn,
addListener:function(el,
eventName,fn){el=Ext.
getDom(el);if(!el|| !fn){returnfalse;}if("unload"==eventName){
unloadListeners[unloadListeners.
length]=[el,
eventName,fn];returntrue;}
// prevent unload errors with simple checkvarwrappedFn=function(e){returntypeofExt!='undefined'?fn(Ext.
lib.
Event.
getEvent(e)):false;};varli=[el,
eventName,fn,
wrappedFn];varindex=listeners.
length;listeners[index]=li;//将这4个东东保存进数组this.
doAdd(el,
eventName,
wrappedFn,
false);
addEventListener){returnfunction(el,
eventName,fn,
capture){el.
addEventListener(eventName,fn,(capture));};//那个函数在这里,这是FF的}elseif(window.
attachEvent){returnfunction(el,
eventName,fn,