mirror of
https://github.com/jech/galene.git
synced 2024-11-23 00:55: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:
parent
85df898101
commit
0bc8129159
1 changed files with 14 additions and 2 deletions
|
@ -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) {
|
||||||
|
|
Loading…
Reference in a new issue