1
Fork 0
mirror of https://github.com/jech/galene.git synced 2024-11-10 02:35:58 +01:00

Disable the present button while setting up a presentation.

Users sometimes click on the button multiple times.
This commit is contained in:
Juliusz Chroboczek 2020-11-09 01:11:13 +01:00
parent 85df898101
commit 0bc8129159

View file

@ -349,9 +349,21 @@ setViewportHeight();
addEventListener('resize', setViewportHeight);
addEventListener('orientationchange', setViewportHeight);
getButtonElement('presentbutton').onclick = function(e) {
getButtonElement('presentbutton').onclick = async function(e) {
e.preventDefault();
addLocalMedia();
let button = this;
if(!(button instanceof HTMLButtonElement))
throw new Error('Unexpected type for this.');
// there's a potential race condition here: the user might click the
// button a second time before the stream is set up and the button hidden.
button.disabled = true;
try {
let id = findUpMedia('local');
if(!id)
await addLocalMedia();
} finally {
button.disabled = false;
}
};
getButtonElement('unpresentbutton').onclick = function(e) {