mirror of
https://codeberg.org/vlw/victorwesterlund.com.git
synced 2025-09-14 03:23:41 +02:00
15 lines
No EOL
307 B
JavaScript
15 lines
No EOL
307 B
JavaScript
export class Dialog {
|
|
constructor(target) {
|
|
this.dialog = document.createElement("dialog");
|
|
|
|
if (typeof this.dialog.showModal !== "function") {
|
|
throw new Error("Browser does not support HTMLDialogElement");
|
|
}
|
|
|
|
document.body.appendChild(this.dialog);
|
|
}
|
|
|
|
open() {
|
|
this.dialog.showModal();
|
|
}
|
|
} |