diff options
| author | polo <ordipolo@gmx.fr> | 2026-01-29 22:51:19 +0100 |
|---|---|---|
| committer | polo <ordipolo@gmx.fr> | 2026-01-29 22:51:19 +0100 |
| commit | e3a42c8342bba0db15e2ca9a78911121e5d539da (patch) | |
| tree | df2b669452ba82774d741a4b9e48948b8dc45a0a /public/js/main.js | |
| parent | f007bac3b9172711dc0fcca1306270ab99dbd8a4 (diff) | |
| download | fullcalendar-master.tar.gz fullcalendar-master.tar.bz2 fullcalendar-master.zip | |
Diffstat (limited to 'public/js/main.js')
| -rw-r--r-- | public/js/main.js | 16 |
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 | ||
| 4 | function 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) | ||
| 12 | function assertElementType(elem, ctor) { | ||
| 13 | if (!(elem instanceof ctor)) { | ||
| 14 | throw new Error(`type attendu: ${ctor.name}, type obtenu: ${elem.tagName}`); | ||
| 15 | } | ||
| 16 | } | ||
