mkuklis/asEvented

Events apply should be FIFO

garex opened this issue · 4 comments

garex commented
// Native js
document.addEventListener('click', function() { console.log(1) })
document.addEventListener('click', function() { console.log(2) })

// jQuery
jQuery(document).click(function() { console.log(3) })
jQuery(document).click(function() { console.log(4) })

Result:

1
2
3
4

But in asEvented apply order is from last to first. This is confusing.

  1. Why did you choose such order -- LIFO?
  2. May be change it to FIFO?

@garex you are right. I'm not sure if this was intentional. I'm open for pull requests. Do you want to send one?

garex commented

@mkuklis ok, I will.

In the meantime you can setup tests in all popular browsers on travis+sause combination.

Pls see this project as example: https://github.com/garex/angular-sorted-map

@garex cool thanks. I will check it out.

garex commented

@mkuklis I sent pr #25 regarding this issue.