Commit 668fae29 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Add some more typing assertions to sfu.js.

parent 0067edc6
...@@ -74,6 +74,9 @@ function gotClose(code, reason) { ...@@ -74,6 +74,9 @@ function gotClose(code, reason) {
console.warn('Socket close', code, reason); console.warn('Socket close', code, reason);
} }
/**
* @param {Stream} c
*/
function gotDownStream(c) { function gotDownStream(c) {
c.onclose = function() { c.onclose = function() {
delMedia(c.id); delMedia(c.id);
...@@ -110,6 +113,10 @@ function changePresentation() { ...@@ -110,6 +113,10 @@ function changePresentation() {
} }
} }
/**
* @param {string} id
* @param {boolean} visible
*/
function setVisibility(id, visible) { function setVisibility(id, visible) {
let elt = document.getElementById(id); let elt = document.getElementById(id);
if(visible) if(visible)
...@@ -262,6 +269,9 @@ async function setMediaChoices() { ...@@ -262,6 +269,9 @@ async function setMediaChoices() {
mediaChoicesDone = true; mediaChoicesDone = true;
} }
/**
* @param {string} id
*/
function newUpStream(id) { function newUpStream(id) {
let c = serverConnection.newUpStream(id); let c = serverConnection.newUpStream(id);
c.onstatus = function(status) { c.onstatus = function(status) {
...@@ -278,6 +288,9 @@ function newUpStream(id) { ...@@ -278,6 +288,9 @@ function newUpStream(id) {
return c; return c;
} }
/**
* @param {string} [id]
*/
async function addLocalMedia(id) { async function addLocalMedia(id) {
if(!getUserPass()) if(!getUserPass())
return; return;
...@@ -353,6 +366,9 @@ async function addShareMedia(setup) { ...@@ -353,6 +366,9 @@ async function addShareMedia(setup) {
setButtonsVisibility() setButtonsVisibility()
} }
/**
* @param {Stream} c
*/
function stopUpMedia(c) { function stopUpMedia(c) {
if(!c.stream) if(!c.stream)
return; return;
...@@ -364,6 +380,9 @@ function stopUpMedia(c) { ...@@ -364,6 +380,9 @@ function stopUpMedia(c) {
}); });
} }
/**
* @param {Stream} c
*/
function delUpMedia(c) { function delUpMedia(c) {
stopUpMedia(c); stopUpMedia(c);
delMedia(c.id); delMedia(c.id);
...@@ -514,6 +533,10 @@ function resizePeers() { ...@@ -514,6 +533,10 @@ function resizePeers() {
let users = {}; let users = {};
/**
* @param {string} id
* @param {string} name
*/
function addUser(id, name) { function addUser(id, name) {
if(!name) if(!name)
name = null; name = null;
...@@ -528,6 +551,10 @@ function addUser(id, name) { ...@@ -528,6 +551,10 @@ function addUser(id, name) {
div.appendChild(user); div.appendChild(user);
} }
/**
* @param {string} id
* @param {string} name
*/
function delUser(id, name) { function delUser(id, name) {
if(!name) if(!name)
name = null; name = null;
...@@ -546,6 +573,11 @@ function resetUsers() { ...@@ -546,6 +573,11 @@ function resetUsers() {
delUser(id, users[id]); delUser(id, users[id]);
} }
/**
* @param {string} id
* @param {string} kind
* @param {string} name
*/
function gotUser(id, kind, name) { function gotUser(id, kind, name) {
switch(kind) { switch(kind) {
case 'add': case 'add':
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment