Is there a way to post an event to a view model wi...
# ballast
r
Is there a way to post an event to a view model without having an InputHandlerScope?
c
No, and this is intentional. In keeping with the purity of the MVI model, the only thing that goes into the ViewModel is an Input, and being able to just post Events directly from the UI or somewhere else really muddies up the distinction between Inputs and Events.
r
So if I have an external event (like the result of an auth popup that I don't control) the right way to do that is to model that as an Input?
It makes sense.. its an input into the state system, even if its not user-driven.
c
Yes, that’s correct, anything that goes into the VM must be modeled as an Input, and it’s not limited to user-initiated things. It’s helpful to consider the user’s actions when defining the Contract, but there’s nothing wrong with adding Inputs for other things as well
👍 1