Disable button until benchmark session is completed

This commit is contained in:
Raymond Hill 2020-10-27 13:07:05 -04:00
parent 4059a92838
commit a1aa9bd54f
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
2 changed files with 8 additions and 7 deletions

View File

@ -42,7 +42,7 @@
</div>
<hr>
<div id="dev">
<button id="sfneBenchmark">Benchmark static filtering engine</button>
<button id="sfneBenchmark" type="button">Benchmark static filtering engine</button>
<div id="sfneBenchmarkResult"></div>
</div>
</div>

View File

@ -43,13 +43,14 @@
document.getElementById('dev').classList.add('enabled');
const sfneBenchmark = async ( ) => {
const result = await vAPI.messaging.send('dashboard', {
document.getElementById('sfneBenchmark').addEventListener('click', ev => {
const button = ev.target;
button.setAttribute('disabled', '');
vAPI.messaging.send('dashboard', {
what: 'sfneBenchmark',
}).then(result => {
document.getElementById('sfneBenchmarkResult').textContent = result;
button.removeAttribute('disabled');
});
document.getElementById('sfneBenchmarkResult').textContent = result;
};
document.getElementById('sfneBenchmark').addEventListener('click', ( ) => {
sfneBenchmark();
});
})();