Event each time component becomes visible

What I finally did (which is not very beautiful but works while I don’t have a better way to do it…) is to use the ngAfterContentChecked() callback and handle the change myself. @ViewChild(‘map’) m; private isVisible: boolean = false; ngAfterContentChecked(): void { if (this.isVisible == false && this.m.nativeElement.offsetParent != null) { console.log(‘isVisible switched from false … Read more

Relation between command handlers, aggregates, the repository and the event store in CQRS

The following is based on my own experience and my experiments with various frameworks like Lokad.CQRS, NCQRS, etc. I’m sure there are multiple ways to handle this. I’ll post what makes most sense to me. 1. Aggregate Creation: Every time a command handler needs an aggregate, it uses a repository. The repository retrieves the respective … Read more

How do I capture a “response end” event in node.js+express?

Strangely enough, it appears that the response emits a “finish” event when the response is closed: https://web.archive.org/web/20120825112648/http://sambro.is-super-awesome.com/2011/06/27/listening-for-end-of-response-with-nodeexpress-js/ Despite this blog entry being a bit old, this event still exists (Line 836 in lib/http.js), so I assume it won’t disappear soon, even though neither node’s nor express’ documentation mention it. By early 2014 it has moved … Read more

Angular 2 – List of events

The default handled events should be mapped from the original HTML DOM component’s events: http://www.w3schools.com/jsref/dom_obj_event.asp by just removing the on prefix. onclick —> (click) onkeypress —> (keypress) etc… You can also create your custom events. However ngInit is not an HTML event, this is part of the Angular’s Component lifecycle, and in Angular 2 they … Read more

IObservable vs Plain Events or Why Should I use IObservable?

Observable is the cornerstone of the Rx library. They provide pretty much all the implementations and operators you’ll need. The idea behind IObservable<T> and Rx is not just the “handling” of events, but enabling “LINQ to Events.” So you can easily compose “event streams,” which gives you a lot of power compared to regular event … Read more

Events not being tracked in new Google Analytics (analytics.js) setup

If you are using Google Tag Manager and also want to trigger some events via code, ga(‘send’…) does not appear to be enough. You need to first fetch the appropriate analytics object: if (“ga” in window) { tracker = ga.getAll()[0]; if (tracker) tracker.send(“event”, “Test”, “Test GA”); } Note that this assumes you’re only using a … Read more

Determine whether user clicking scrollbar or content (onclick for native scroll bar)

Solved: A shortest scrollbar click detection I could come up with, tested on IE, Firefox, Chrome. var clickedOnScrollbar = function(mouseX){ if( $(window).outerWidth() <= mouseX ){ return true; } } $(document).mousedown(function(e){ if( clickedOnScrollbar(e.clientX) ){ alert(“clicked on scrollbar”); } }); Working example: https://jsfiddle.net/s6mho19z/

Conditional event binding – vuejs

Update (February 2021) Several solutions seem to be accepted on Github, whereas my original answer is not. I’m rounding them up here for convenience: Solution 1a (see Engin Yapici’s answer below): v-on=”enableClick ? { click: clickHandler } : {}” Solution 1b (see Heals Legodi’s answer below): v-on=”enableClick ? { click: () => clickHandler(params) } : … Read more

GWT Custom Events

Events in general: Events are always sent to inform about something (e.g. a change of state). Let’s take your example with a man and a wall. Here we can imagine that there is a game where a user can walk as a man in a labyrinth. Every time a user hits the wall it should … Read more