reducer-interface
Installation
$ npm install reducer-interface --save
Usage
static maxPlayers = 4 { thisplayers = thisplayersCount = 0 thisgameIsReadyToStart = false thisrequestSession = false thissectionOfplayersIsFull = false thisgameIsStarted = false thisisMissedPlayers = false thisrequestRound = false thiscurrentRound = null } { thisplayers this if thisplayersCount === GamemaxPlayers thisgameIsReadyToStart = true else if thisplayersCount < GamemaxPlayers thisisMissedPlayers = false } { const playerIndex = thisplayers thisplayers this if thisplayersCount < GamemaxPlayers thissectionOfplayersIsFull = thissectionOfplayersIsFull && false thisgameIsReadyToStart = thisgameIsReadyToStart && false } { thissessionId = sessionId if thisplayersCount === GamemaxPlayers && thisquestionsIsReady thisgameIsStarted = true thissectionOfplayersIsFull = false else if thisplayersCount !== GamemaxPlayers if thisplayersCount < GamemaxPlayers thisisMissedPlayers = true } { thiscurrentRound = round } { thisplayersCount = thisplayerslength } // ... Game { this } { this } { thisrequestSession = true } { thisrequestSession = false this } { thisrequestRound = true } { thisrequestRound = false this } // ...
Methods
merge(data)
Can be used in cases manually or in Interface methods.
// ... { this} // ... or ... { this} // ... { this } // ...
Merging data with current state. See more super-merge.