You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be nice to have a chance before a model is actually inserted/removed from a collection or changed to enforce any collection invariants.
For example, say I have a collection of apple models, but I am only allowed to have one green apple at a time. On a pre-add I could check that the new apple is green and remove any existing green apple, and this would work regardless of what actually called the .add().
Likewise, if we had a pre-change event from ampersand-state, then the invariant could still be enforced when an apple changed from red to green, no matter where or what triggered the change.
Maybe a better example would be an invariant that there can be only a single model where selected is true.
(any pre-change event would be a matter for ampersand-state to implement, of course)
The text was updated successfully, but these errors were encountered:
It would be nice to have a chance before a model is actually inserted/removed from a collection or changed to enforce any collection invariants.
For example, say I have a collection of apple models, but I am only allowed to have one green apple at a time. On a pre-add I could check that the new apple is green and remove any existing green apple, and this would work regardless of what actually called the
.add()
.Likewise, if we had a pre-change event from ampersand-state, then the invariant could still be enforced when an apple changed from red to green, no matter where or what triggered the change.
Maybe a better example would be an invariant that there can be only a single model where
selected
istrue
.(any pre-change event would be a matter for ampersand-state to implement, of course)
The text was updated successfully, but these errors were encountered: