New principle: Events should only fire during actual state transitions #483
Labels
Status: Consensus to write
We have TAG consensus about the principle but someone needs to write it (see "To Write" project)
Topic: Event Design
Milestone
This was brought up in our discussion of w3ctag/design-reviews#843
It started as a naming observation:
change
is far more common thanupdate
in event names. Then we realized thatupdate
may be more appropriate when the event invocation happens regardless of actual state change. However, that does not seem to be followed by the web platform, e.g. reading the MDN docs ontimeupdate
, it sounds like it would only fire when the time has actually updated.Regardless, events that fire when things have not actually changed should be an antipattern. This is basically polling in disguise: the whole architectural reason to use events is that they fire during state transitions. Not only is this wasteful, it’s unclear whether there is an actual benefit to it (compared to only firing the event when there is a state transition).
The text was updated successfully, but these errors were encountered: