A lot of times when writing things you may want want to react to certain events on your page.
We do this all the time with builtin ones like click...
For further actions, you may consider blocking this person and/or reporting abuse
Thanks Clay for the refresher. In the example for event listening you have
console.lo
rather thenconsole.log
. I like the pub/sub example and could be packaged into a tiny library.Do you use this as cross components communication? Example trigger a function in a sibling component?
Sure. That's a solid use case.
Thanks for your reply Clay.
I try to keep it top-down but I’ve faced a couple of situations where this pub/sub using the native event bubbling would come in real handy. Didn’t reach for it yet though.
This is awesome, I had no idea. Thanks!
Wow, amazing! Never heard of this thing,plz don't tease me, I'm just a little newb 😂 thanks so much for sharing this 🤗
Really cool! I don't know why I haven't seen this before!