Concept
Presenters
State → view. Nothing more.
A presenter is a thin class that:
- Observes state (MobX
autorunor reactions). - Translates state into view calls (
reelSet.setResult(...), DOM updates). - Exposes a narrow API the FSM can drive (
startSpin(),showWin()).
It does not decide when. A presenter with a setTimeout
inside it is a presenter doing too much.
The two slotplate ships
-
ReelsPresenter— wraps the reel engine (pixi-reels). Only file outsideview/allowed to import it. Defines theReelsEngineinterface — swap implementations here. -
HUDPresenter— binds MobX state to the plain DOM buttons inindex.html. Swap for a React component if you want, as long as it keeps the same surface (mount(root),dispose()).
When to add a presenter
Add a new presenter when you have a new view surface to bridge:
WinlinePresenterfor an overlay that draws payline paths.BigWinPresenterfor a scene that dims the reels and counts up.SoundPresenterif sound cues are driven by state (probably, for slots).
The MVP name
Yes this is Model-View-Presenter, roughly. Close cousin to MVVM. slotplate uses "presenter" because they tend to be thinner than a ViewModel — no two-way binding, just observable read and view write.