mirror of https://github.com/bra1n/townsquare.git
adding documentation comment to explain new isFromSockets property
This commit is contained in:
parent
8b4f09a2c4
commit
dedf0be0b9
|
@ -102,6 +102,14 @@ const mutations = {
|
||||||
set(state, players = []) {
|
set(state, players = []) {
|
||||||
state.players = players;
|
state.players = players;
|
||||||
},
|
},
|
||||||
|
/**
|
||||||
|
The update mutation also has a property for isFromSockets
|
||||||
|
this property can be addded to payload object for any mutations
|
||||||
|
then can be used to prevent infinite loops when a property is
|
||||||
|
able to be set from multiple different session on websockets.
|
||||||
|
An example of this is in the sendPlayerPronouns and _updatePlayerPronouns
|
||||||
|
in socket.js.
|
||||||
|
*/
|
||||||
update(state, { player, property, value }) {
|
update(state, { player, property, value }) {
|
||||||
const index = state.players.indexOf(player);
|
const index = state.players.indexOf(player);
|
||||||
if (index >= 0) {
|
if (index >= 0) {
|
||||||
|
|
Loading…
Reference in New Issue