summaryrefslogtreecommitdiff
path: root/public/js/main.js
diff options
context:
space:
mode:
authorpolo <ordipolo@gmx.fr>2026-01-29 22:51:19 +0100
committerpolo <ordipolo@gmx.fr>2026-01-29 22:51:19 +0100
commite3a42c8342bba0db15e2ca9a78911121e5d539da (patch)
treedf2b669452ba82774d741a4b9e48948b8dc45a0a /public/js/main.js
parentf007bac3b9172711dc0fcca1306270ab99dbd8a4 (diff)
downloadfullcalendar-e3a42c8342bba0db15e2ca9a78911121e5d539da.tar.gz
fullcalendar-e3a42c8342bba0db15e2ca9a78911121e5d539da.tar.bz2
fullcalendar-e3a42c8342bba0db15e2ca9a78911121e5d539da.zip
classe CalendarModalView, contrôles getElementOrThrow et assertElementTypeHEADmaster
Diffstat (limited to 'public/js/main.js')
-rw-r--r--public/js/main.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/public/js/main.js b/public/js/main.js
new file mode 100644
index 0000000..50eedf6
--- /dev/null
+++ b/public/js/main.js
@@ -0,0 +1,16 @@
1// js/main.js
2
3// réussite de getElementById
4function getElementOrThrow(id) {
5 const elem = document.getElementById(id);
6 if (!elem) {
7 throw new Error("l'élément d'id: " + id + " non trouvé");
8 }
9 return elem;
10}
11// l'erreur attribut "value" non trouvé devient l'élement attrapé n'a pas le bon type (c'est un peu plus clair)
12function assertElementType(elem, ctor) {
13 if (!(elem instanceof ctor)) {
14 throw new Error(`type attendu: ${ctor.name}, type obtenu: ${elem.tagName}`);
15 }
16}