Issues (40)

app/assets/javascripts/wait.js (3 issues)

1
// BigBlueButton open source conferencing system - http://www.bigbluebutton.org/.
2
//
3
// Copyright (c) 2018 BigBlueButton Inc. and by respective authors (see below).
4
//
5
// This program is free software; you can redistribute it and/or modify it under the
6
// terms of the GNU Lesser General Public License as published by the Free Software
7
// Foundation; either version 3.0 of the License, or (at your option) any later
8
// version.
9
//
10
// BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY
11
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
12
// PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
13
//
14
// You should have received a copy of the GNU Lesser General Public License along
15
// with BigBlueButton; if not, see <http://www.gnu.org/licenses/>.
16
17
// Handle client request to join when meeting starts.
18
$(document).on("turbolinks:load", function(){
19
  var controller = $("body").data('controller');
20
  var action = $("body").data('action');
21
22
  if(controller == "rooms" && action == "join"){
23
    App.waiting = App.cable.subscriptions.create({
0 ignored issues
show
The variable App seems to be never declared. If this is a global, consider adding a /** global: App */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
24
      channel: "WaitingChannel",
25
      roomuid: $(".background").attr("room"),
26
      useruid: $(".background").attr("user")
27
    }, {
28
      connected: function() {
29
        console.log("connected");
0 ignored issues
show
console.log looks like debug code. Are you sure you do not want to remove it?
Loading history...
30
        setTimeout(startRefreshTimeout, 120000);
31
      },
32
33
      disconnected: function(data) {
34
        console.log("disconnected");
35
        console.log(data);
36
      },
37
38
      rejected: function() {
39
        console.log("rejected");
40
      },
41
42
      received: function(data){
43
        console.log(data);
44
        if(data.action == "started"){
45
          request_to_join_meeting();
46
        }
47
      }
48
    });
49
  }
50
});
51
52
var join_attempts = 0;
53
54
function request_to_join_meeting() {
55
  $.post(window.location.pathname, { join_name: $(".background").attr("join-name") }, function() {
56
    //Successful post - set up retry incase
57
    if(join_attempts < 4){ setTimeout(request_to_join_meeting, 10000); }
58
    join_attempts++;
59
  })
60
}
61
62
// Refresh the page after 2 mins and attempt to reconnect to ActionCable 
63
function startRefreshTimeout() {
64
  var url = new URL(window.location.href)
0 ignored issues
show
The variable URL seems to be never declared. If this is a global, consider adding a /** global: URL */ comment.

This checks looks for references to variables that have not been declared. This is most likey a typographical error or a variable has been renamed.

To learn more about declaring variables in Javascript, see the MDN.

Loading history...
65
  url.searchParams.set("reload","true")
66
  window.location.href = url.href
67
}
68