@pozdnyakov this is how it is done on the SysApps EventTarget. The reason of keeping the Event Listener logic on the JavaScript shim is merely a simplification/optimization.

If we move the logic to the C++ code, we would need to send a message from the JS to the native backend every time a new listener is added or removed. Another problem of keeping track of the listeners in the native side is we would need to send the very same event message to every listener for every event occurrence, instead, we send a single message to the JS shim and it propagates the message to all the listeners.