Closed yannsucc closed 8 years ago
Thanks. I've been busy recently so I won't be able to test, but in 2 days I have 2 weeks to fix this project and make sure it's not broken. Thanks again.
For starters, events will probably be improved alot soon. Regex/custom events is certainly on my mental todo.
In terms of what to do if calling an event that doesn't exist, I think it should just fail gracefully and return false. Events are really only called by internal library code when data is recieved. That data has a type, and tries to run an event with that type here. Throwing an error is bad because the server should be able to send events, and not rely on clients to listen to them. Perhaps it could return false if it doesn't exist, and then, #if debug
then output something to console ('Recieved an event but no listener was registered'). That could perhaps be useful for typos (server sends event with type PlayerMove
and client is listening for PlayerUpdate
)
I'll get to this soon, but it's not too important yet.