2)
Then, I encountered the infinite loop, handleError()->dispatchEvent()->handleError()…
functionhandleError(message,exception){logLog.error(message,exception);log4javascript.dispatchEvent("error",{"message":message,"exception":exception});}dispatchEvent: function(eventType,eventArgs){if(array_contains(this.eventTypes,eventType)){varlisteners=this.eventListeners[eventType];for(vari=0,len=listeners.length;i<len;i++){listeners[i](this,eventType,eventArgs);}}else{handleError("log4javascript.EventSupport ["+this+"]: dispatchEvent: no event called '"+eventType+"'");}}
log4javascript 1.4.2
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
It's a fair point that it can get into an infinite loop, but since I'd never really intended for the setEventTypes() method to be used except internally and you could just use log4javascript.setEventTypes(), I'm not too worried.
How do you want to use it?
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Must not rewrite default EventTypes("load", "errror") ?
I encountered the infinite loop as follows.
1)
I modified default EventTypes as follows.
default: log4javascript.setEventTypes();
modified: log4javascript.setEventTypes();
2)
Then, I encountered the infinite loop, handleError()->dispatchEvent()->handleError()…
It's a fair point that it can get into an infinite loop, but since I'd never really intended for the setEventTypes() method to be used except internally and you could just use log4javascript.setEventTypes(), I'm not too worried.
How do you want to use it?