1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-11-22 16:45:58 +01:00

Add some more typing assertions to sfu.js.

This commit is contained in:
Juliusz Chroboczek 2020-08-13 20:55:13 +02:00
parent 0067edc6eb
commit 668fae29ef

View file

@ -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() {
} }
} }
/**
* @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() {
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) {
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) {
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) {
}); });
} }
/**
* @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() {
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) {
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() {
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':