-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR updates some of the error handling to give nicer error messages in the error bar. It shows the error name in bold up front, and preserves stacktraces a little better. Before: ![error-pre](https://github.com/hrgdavor/jscadui/assets/1766297/2ed874bd-de69-4165-8ede-dbd9e8486f1f) After: ![error-post](https://github.com/hrgdavor/jscadui/assets/1766297/72f0027e-b6e0-4179-849d-2e287c932084) I also fixed a bug where generating a bunch of designs in a row (such as by changing parameters), the progress spinner would disappear after the first job even though jobs are still pending. I changed this to track the number of pending jobs and only hide the spinner when there are no pending jobs. I also fixed some code style issues from prettier, mostly single quote strings.
- Loading branch information
Showing
11 changed files
with
80 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,41 +1,41 @@ | ||
import { examples } from './examples.js' | ||
|
||
const menu = document.getElementById("menu") | ||
const menu = document.getElementById('menu') | ||
|
||
export const init = (loadExample) => { | ||
const button = document.getElementById("menu-button") | ||
const content = document.getElementById("menu-content") | ||
const button = document.getElementById('menu-button') | ||
const content = document.getElementById('menu-content') | ||
|
||
// Menu button | ||
button.addEventListener("click", () => { | ||
menu.classList.toggle("open") | ||
button.addEventListener('click', () => { | ||
menu.classList.toggle('open') | ||
}) | ||
|
||
// Close menu when anything else is clicked | ||
window.addEventListener("click", (e) => { | ||
window.addEventListener('click', (e) => { | ||
if (!button.contains(e.target) && !content.contains(e.target)) { | ||
dismiss() | ||
} | ||
}) | ||
window.addEventListener("drop", () => dismiss()) | ||
window.addEventListener("dragstart", () => dismiss()) | ||
window.addEventListener("dragover", () => dismiss()) | ||
window.addEventListener('drop', () => dismiss()) | ||
window.addEventListener('dragstart', () => dismiss()) | ||
window.addEventListener('dragover', () => dismiss()) | ||
|
||
// Add examples to menu | ||
const exampleDiv = document.getElementById("examples") | ||
const exampleDiv = document.getElementById('examples') | ||
examples.forEach(({ name, source }) => { | ||
const a = document.createElement("a") | ||
const a = document.createElement('a') | ||
a.innerText = name | ||
a.addEventListener("click", async () => { | ||
a.addEventListener('click', async () => { | ||
console.log(`load example ${name}`) | ||
loadExample(await (await fetch(source)).text()) | ||
}) | ||
const li = document.createElement("li") | ||
const li = document.createElement('li') | ||
li.appendChild(a) | ||
exampleDiv.appendChild(li) | ||
}) | ||
} | ||
|
||
const dismiss = () => { | ||
menu.classList.remove("open") | ||
menu.classList.remove('open') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters