3 ms·
You can still uses events and state against UI constructs without going full-on OOP. An application can render in similar ways to how flux, mercury, elm and ot
by tracker1 12y ago
You can still uses events and state against UI constructs without going full-on OOP. An application can render in similar ways to how flux, mercury, elm and other patterns are handled. (not suggesting a virtual DOM... but there's more to an application than the UI alone, and there are more functional ways to apply state and eventing to a UI.
uicontrol.on('eventName', handleSomeEvent.bind(null, state, uicontrol));
In this case, you still have a uicontrol, that raises events, and can use that to trigger a generic handler pre-bound against a given state. You can remove this farther by having the handleSomeEvent being a method that is already part of a state machine that is bound against an instance of said state.
If you follow 1-way dataflows (like flux) you can break some of the other constructs down... just the same, the above example is not OOP, but can still use UI events, and be composable.