DEV Community

Discussion on: When Event Listeners Won't Listen

Collapse
 
jamesthomson profile image
James Thomson

This is what I was thinking while reading this as well. Rather than manage event listeners, manage the current state. Much simpler (and modular) to switch around the paintbrush type and call the associated function(s).

Collapse
 
ionline247 profile image
Matthew Bramer • Edited

Maintaining state would be the preferred approach. He could even use a pub/sub <gasp/> event listener and toggle state that way