Stop using async ajax requests

master
Daniel Berteaud 10 years ago
parent c3bee91b58
commit c9e37c8ab8
  1. 20
      public/js/vroom.js

@ -542,7 +542,6 @@ function initAdminRooms(){
} }
}) })
}, },
async: false,
error: function(data){ error: function(data){
showApiError(data); showApiError(data);
}, },
@ -699,7 +698,7 @@ function initVroom(room) {
} }
// Get our role and other room settings from the server // Get our role and other room settings from the server
function getRoomInfo(){ function getRoomInfo(ev){
$.ajax({ $.ajax({
data: { data: {
req: JSON.stringify({ req: JSON.stringify({
@ -710,7 +709,6 @@ function initVroom(room) {
} }
}) })
}, },
async: false,
error: function(data){ error: function(data){
showApiError(data); showApiError(data);
}, },
@ -756,6 +754,14 @@ function initVroom(room) {
$('#askForNameSet').bootstrapSwitch('state', data.ask_for_name == 'yes'); $('#askForNameSet').bootstrapSwitch('state', data.ask_for_name == 'yes');
$('#joinPassSet').bootstrapSwitch('state', data.join_auth == 'yes'); $('#joinPassSet').bootstrapSwitch('state', data.join_auth == 'yes');
$('#ownerPassSet').bootstrapSwitch('state', data.owner_auth == 'yes'); $('#ownerPassSet').bootstrapSwitch('state', data.owner_auth == 'yes');
if (ev === 'join'){
if (data.ask_for_name && data.ask_for_name === 'yes'){
$('#display-name-pre').slideDown();
}
else{
webrtc.joinRoom(room);
}
}
} }
}); });
} }
@ -1478,13 +1484,7 @@ function initVroom(room) {
// Or prompt for a name first // Or prompt for a name first
webrtc.once('readyToCall', function () { webrtc.once('readyToCall', function () {
peers.local.id = webrtc.connection.socket.sessionid; peers.local.id = webrtc.connection.socket.sessionid;
getRoomInfo(); getRoomInfo('join');
if (roomInfo.ask_for_name && roomInfo.ask_for_name == 'yes'){
$('#display-name-pre').slideDown();
}
else{
webrtc.joinRoom(room);
}
}); });
// When we joined the room // When we joined the room

Loading…
Cancel
Save