1(function (){ 2 3 var FWDRLEventDispatcher = function (){ 4 5 this.listeners = {events_ar:[]}; 6 7 this.addListener = function (type, listener){ 8 9 if(type == undefined) throw Error("type is required."); 10 if(typeof type === "object") throw Error("type must be of type String."); 11 if(typeof listener != "function") throw Error("listener must be of type Function."); 12 13 14 var event = {}; 15 event.type = type; 16 event.listener = listener; 17 event.target = this; 18 this.listeners.events_ar.push(event); 19 }; 20 21 this.dispatchEvent = function(type, props){ 22 if(this.listeners == null) return; 23 if(type == undefined) throw Error("type is required."); 24 if(typeof type === "object") throw Error("type must be of type String."); 25 26 for (var i=0, len=this.listeners.events_ar.length; i < len; i++){ 27 if(this.listeners.events_ar[i].target === this && this.listeners.events_ar[i].type === type){ 28 if(props){ 29 for(var prop in props){ 30 this.listeners.events_ar[i][prop] = props[prop]; 31 } 32 } 33 this.listeners.events_ar[i].listener.call(this, this.listeners.events_ar[i]); 34 } 35 } 36 }; 37 38 this.removeListener = function(type, listener){ 39 40 if(type == undefined) throw Error("type is required."); 41 if(typeof type === "object") throw Error("type must be of type String."); 42 if(typeof listener != "function") throw Error("listener must be of type Function." + type); 43 44 for (var i=0, len=this.listeners.events_ar.length; i < len; i++){ 45 if(this.listeners.events_ar[i].target === this 46 && this.listeners.events_ar[i].type === type 47 && this.listeners.events_ar[i].listener === listener 48 ){ 49 this.listeners.events_ar.splice(i,1); 50 break; 51 } 52 } 53 }; 54 55 /* destroy */ 56 this.destroy = function(){ 57 this.listeners = null; 58 59 this.addListener = null; 60 this.dispatchEvent = null; 61 this.removeListener = null; 62 }; 63 64 }; 65 66 window.FWDRLEventDispatcher = FWDRLEventDispatcher; 67}(window));
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.