Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
IWCL_HookEvent in IWCommon.js correct?
#1
This function is called internally by IW to attach an event handler to an object. For example an onclick event.
If the html already declares an onclick event listener for that object, IWCL_HookEvent moves this original event handler to an internal structure (array[]) and adds the new one.
This way they both get called I presumed but that didn't work.
Debugging the code I am not sure if following is ok.

Code:
   IWCL_HookEvent: function(eventName, eventHandler) {
       var i = IW.Events.findByName(eventName);
       logMessage("IWCL_HookEvent(): eventName = " + eventName);
       if (this.IEEventHandlers[i] == null) {
           this.IEEventHandlers[i] = [];
           var xEventName = "on" + eventName;
           if (this[xEventName] != null) {
               this.IEEventHandlers[0] = this[xEventName]       // <<-- replace with this.IEEventHandlers[i][0] = this[xEventName]  ?????
           }
           this[xEventName] = IW.Events.IWEventHandler;
       }
Reply
#2
Interesting.... At first, seems that your assumption is correct. I'll check it and let you know.
Reply
#3
Which version are you using Jeroen? I believe you are correct. I'm performing some tests and if everything is OK I can release both a new update or a path, depending on the version you are using.
Reply
#4
(03-04-2019, 10:01 AM)Alexandre Machado Wrote: Which version are you using Jeroen? I believe you are correct. I'm performing some tests and if everything is OK I can release both a new update or a path, depending on the version you are using.

I found it using IW15.0.17. Retested with IW15.0.18. Same code here.
FYI: I made the change myself in the debug version and it fixes my problem.
Reply
#5
Thanks. Putting this in 15.0.19 will be easy.
Reply
#6
Howdy all!

I bet this is the cause of one of the issues I was having where an OnXXX wasn't getting called!

All the best,

Shane
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)