public/js/lobby.js
// fetch all rooms from server, and display them on screen
fetch all rooms from server, and display them on screen
fetch all rooms from server and display them on screen
function fetchRooms(){
        $.get('/rooms', function(rooms){
            rooms = CircularJSON.parse(rooms);
            _.each(rooms, function(room, id){
                room.host = room.owner;
                room.type = room.gameScenario;
                room.players = _.map(_.values(room.users), function(u){
                    return u.user;
                });
                if (_.isEmpty(room.players)) delete rooms[id];
            });
            renderMatches(rooms);
        });
    }
function fetchRooms ( ) { $ . get ( '/rooms' , function ( rooms ) { rooms = CircularJSON . parse ( rooms ) ; _ . each ( rooms , function ( room , id ) { room . host = room . owner ; room . type = room . gameScenario ; room . players = _ . map ( _ . values ( room . users ) , function ( u ) { return u . user ; } ) ; if ( _ . isEmpty ( room . players ) ) delete rooms [ id ] ; } ) ; renderMatches ( rooms ) ; } ) ; }
fetch all rooms from server, and display them on screen
fetch all rooms from server and display them on screen