Skip to content

Conversation

@acostarelli
Copy link
Contributor

No description provided.

sirpython and others added 17 commits August 7, 2015 17:31
setMessageListener is a new method that is aiming to replace the message queue system. When you call it, you can pass in a set of types. These types describe the kinds of messages that the listener should respond to if received. For example, if you did:

CardshifterServerAPI.setMessageListener(function(message) {
     ...
}, ["chat", "userstatus"]);

Then, every time a message was received and it's .command is either "chat" or "userstatus", then the function passed in will be called and the received message will be passed in.
This command map is an object where the keys are the .command s of messages, and the values are functions. When a message is received, it's command is used to find the function to call that will act on the newly received message. This is definitely much more structured and cleaner than the old lobby controller.
addEventTypes -- add new event types to the event types listener

removeMessageListener -- remove the message listener
API 2.0; now, instead of hiring a mailman, you set a message listener
… newgame will only come when expected (and the commandMap allows the code to act properly when the message is received)
lobby now conforms to the new API, slight API updates (mainly convention)
acostarelli pushed a commit that referenced this pull request Aug 8, 2015
@acostarelli acostarelli merged commit 2fed96a into deck-builder Aug 8, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants