Skip to content

Instantly share code, notes, and snippets.

@Rulexec
Created March 28, 2015 22:34
Show Gist options
  • Save Rulexec/de4285992d7dc2de25ec to your computer and use it in GitHub Desktop.
Save Rulexec/de4285992d7dc2de25ec to your computer and use it in GitHub Desktop.
function showLobby(session) {
var lobby = new LobbyClient({session: session});
var lobbyUi = new LobbyUi({element: rootElement});
var processLobbyEventsUntilNotJoinRoom = lobbyUi.poll().bind(function(event) {
if (event.type === LobbyUi.EVENTS.JOIN_ROOM) {
this.cont(null, event.id);
} else {
return processLobbyEventsUntilNotJoinRoom;
}
});
return lobby.getAllRooms().bind(lobbyUi.rooms
).skip(lobbyUi.start()).skip(processLobbyEventsUntilNotJoinRoom);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment