chaosmonster

a little bit of chaos and coding

Posts

Subscribe to DOM Events in Angular

So my basic problem was, that I needed to somehow delay a blur event (or to be precise the callback function) after a click event.
My first thought was to use a debounceTime operator from rxjs, but I found out that blur is a real EventListener and not the rx counter part Observale.ofEvent.

While the “This.JavaScript” panel at 29. January 2017 Ben Lesh mentioned something about rxjs doing some stuff with zone.js.
After the show I dug into the issues on github and found this issue, where Miško introduces what I was looking for. As this issue from December and seems to depend on changes in rxjs I’m hoping that it may be part of some minor version of Angular 4 if not of the verison 4 itself in March/ April this year.

Btw my first problem could be solved like explained here or like I did in the above case move from the click event to the mousedown event as it is executed before the blur event.