colyseus / docs

Documentation for Colyseus
https://docs.colyseus.io
10 stars 72 forks source link

Add note for onAdd's second param #149

Closed francislavoie closed 11 months ago

francislavoie commented 11 months ago

Related to https://github.com/colyseus/schema/issues/147

Currently, this second param is undocumented, I had to dig through github issues to find the solution for my problem.

This note might not be quite right, it assumes the TypeScript implementation. Do other langs behave the same, do they have the same 2nd param?

The fn signature should probably be mentioned in some way or another. And I think it should be mentioned that listen() can have this same problem it seems (causing a listen -> onAdd nesting to cause onAdd to still trigger multiple times if the data existed before the user joins the room).

endel commented 11 months ago

Thank you so much for this @francislavoie 🎉 I added the signature as you suggested and described the default behaviour of second argument ("triggerAll" )