I see other questions for how to create custom events, but I'm not clear on how to track specific custom conditions.
In my example, I need to "listen" for the eventuality that an array has gone from having x elements to y elements.
I'm not sure if it's a good idea to prototype on top of Array, though that's kind of ideally what I need.
However, the broader question is, what's the methodology for writing custom listeners that are effectively the analog of -pseudo-
onClockStruckTwo or onDomChanged or onRapture
Meaning, that rather than waiting for some other predefined onEvent (onclick, onkeydown, etc) to happen, I want to make my own.
And please no Framework answers. I'm trying to understand how this actually works in native javascript.
TIA