Commit 0bc81291 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Disable the present button while setting up a presentation.

Users sometimes click on the button multiple times.
parent 85df8981
...@@ -349,9 +349,21 @@ setViewportHeight(); ...@@ -349,9 +349,21 @@ setViewportHeight();
addEventListener('resize', setViewportHeight); addEventListener('resize', setViewportHeight);
addEventListener('orientationchange', setViewportHeight); addEventListener('orientationchange', setViewportHeight);
getButtonElement('presentbutton').onclick = function(e) { getButtonElement('presentbutton').onclick = async function(e) {
e.preventDefault(); 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) { getButtonElement('unpresentbutton').onclick = function(e) {
......
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