Skip to content

Commit

Permalink
Implemented error reporting at startup
Browse files Browse the repository at this point in the history
  • Loading branch information
dmotte committed Mar 7, 2024
1 parent 0396024 commit 1cda73d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
12 changes: 9 additions & 3 deletions bnplay-audio-api.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,14 @@
padding: 20px 30px;
font-weight: bold;
}

.btn-ctrl:disabled {
.btn-ctrl-loading {
color: #c60;
border: 1px solid #f80;
}
.btn-ctrl-error {
color: #c00;
border: 1px solid #f00;
}
</style>

<script type="text/javascript">
Expand Down Expand Up @@ -142,11 +145,14 @@

return bnp_load()
.then(() => {
btnToggle.classList.remove("btn-ctrl-loading");
btnToggle.removeAttribute("disabled");
ui_update();
})
.catch((error) => {
console.log(error);
btnToggle.classList.remove("btn-ctrl-loading");
btnToggle.classList.add("btn-ctrl-error");
divStatus.innerHTML = error;
btnToggle.value = "ERROR";
});
Expand Down Expand Up @@ -187,7 +193,7 @@ <h1>Brown noise</h1>
type="button"
id="btnToggle"
value="Loading..."
class="btn-ctrl"
class="btn-ctrl btn-ctrl-loading"
onfocus="this.blur()"
onclick="ui_toggle()"
disabled="disabled"
Expand Down
6 changes: 3 additions & 3 deletions bnplay-audio-tag.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@
padding: 20px 30px;
font-weight: bold;
}

.btn-ctrl:disabled {
.btn-ctrl-loading {
color: #c60;
border: 1px solid #f80;
}
Expand Down Expand Up @@ -109,6 +108,7 @@
function ui_load() {
btnToggle = document.getElementById("btnToggle");

btnToggle.classList.remove("btn-ctrl-loading");
btnToggle.removeAttribute("disabled");
ui_update();
}
Expand Down Expand Up @@ -157,7 +157,7 @@ <h1>Brown noise</h1>
type="button"
id="btnToggle"
value="Loading..."
class="btn-ctrl"
class="btn-ctrl btn-ctrl-loading"
onfocus="this.blur()"
onclick="ui_toggle()"
disabled="disabled"
Expand Down

0 comments on commit 1cda73d

Please sign in to comment.