Custom event logging for Javascript frameworks

Imagine I have a web application with good components encoded with your favorite Javascript library. I actively use custom events to reduce dependencies between these components, so you can easily place them in several contexts, repeat them on the page and / or nest them, as it seems to me.

This is a great picture, but debugging can be pretty painful as I have not found a way to record my custom events. Ideally, I would like to be able to enable logging in my sample (I am using Prototype, currently), and then get the current log of dismissed and observed events at any point or points in the DOM.

I discussed this with another F2E, and there have been several attempts:

  • Visual Event is a bookmarklet that does an excellent job of visualizing events related to events, but does not provide a execution log.
  • Antenna This is only such a magazine, but it seems a bit erroneous and requires modification of the prototype library itself, which feels like a hack.

How do I get the registration I want?

+3
source share
2 answers

, X.fireEvent, (, FW), Object.prototype. , , .

+1

Prototype, wrap document.fire.

+1

Source: https://habr.com/ru/post/1708463/


All Articles