Using Browser Custom Events

Clay Murray on June 26, 2019

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... [Read Full]
markdown guide
 

Thanks Clay for the refresher. In the example for event listening you have console.lo rather then console.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?

 
 

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.

 
 

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!

code of conduct - report abuse