Loading ...
Sorry, an error occurred while loading the content.
 

Re: [ydn-javascript] Events and their stack

Expand Messages
  • Adam Moore
    ... Correct, IE will not fire these listeners in the order they were registered. If you have a situation where order is required, you should register a single
    Message 1 of 2 , Oct 3, 2006
      On Tue, Oct 03, 2006 at 10:40:56AM -0000, Andrei Neculau wrote:
      > Hi
      >
      > Is there a way to make sure of the order of how event listeners are
      > being loaded?
      >
      > If I have an event that has two listeners.. one with "mynumber++" and
      > another one with "mynumber = 5 / mynumber", how do I make sure the
      > second one fires after the first one?
      >
      > Of course it's a stupid example, but it shows that if the second one
      > fires first, it will get division by zero.
      >
      > The only solution I came up with until now, which is not a really
      > great one is to have two events for each of the two listeners, and the
      > first listener to be like "mynumber++; event2.fire();"
      >
      > Is there a clever way to add a listener before/after a previous one?

      Correct, IE will not fire these listeners in the order they were
      registered. If you have a situation where order is required, you should
      register a single listener and have your application code execute both
      functions. CustomEvents do execute the listeners in the order
      registered, so you could use a custom event as a wrapper for your DOM
      event.

      -Adam
    Your message has been successfully submitted and would be delivered to recipients shortly.