Closed bob2517 closed 6 months ago
Real-world example using an existing observe event:
man:if-not-in-house:observe {
set-attribute: data-shoes "";
}
The opposite event when using a regular observe event:
man:if-in-house:observe {
remove-attribute: data-shoes;
}
In the new syntax, this would be reduced to:
man:if-in-house:boolean-observe {
remove-attribute: data-shoes;
}
"boolean-observe" is a working name for the event - it probably won't be this.
Closing for now. Need a practical use case to warrant this.
Set up an observe event that handles opposite reactions without the need for a reverse observe event.
The event will only allow boolean-type actions, like add-class, remove-class, set-attribute/remove-attribute, etc.
Commands like ajax, render, etc. would not be allowed in the event, solely because we don't know what the opposite would be, and adding syntax for coping with that would result in a more complicated solution to simply writing the reverse observe event.
A lot of scenarios could work with this - adding and removing classes for triggering and resetting animations is just one example, which is a staple in modern websites.