Add: htmx debug extension

This commit is contained in:
Aroy-Art 2024-06-16 20:43:16 +02:00
parent aa7bb0b2b0
commit 787ba6d50f
Signed by: Aroy
GPG key ID: DB9689E9391DD156
2 changed files with 18 additions and 0 deletions

View file

@ -4,4 +4,11 @@
<!-- Core JS Files --> <!-- Core JS Files -->
<script src="{% static 'libs/bootstrap/bootstrap.bundle.min.js' %}" type="text/javascript"></script> <script src="{% static 'libs/bootstrap/bootstrap.bundle.min.js' %}" type="text/javascript"></script>
<!-- Htmx JS & Extentions -->
<script src="{% static 'libs/htmx/htmx.min.js' %}" type="text/javascript"></script> <script src="{% static 'libs/htmx/htmx.min.js' %}" type="text/javascript"></script>
{% if DEBUG %}
<!-- Htmx Debug JS -->
<script src="{% static 'libs/htmx/debug.js' %}" type="text/javascript"></script>
{% endif %}

View file

@ -0,0 +1,11 @@
htmx.defineExtension('debug', {
onEvent: function (name, evt) {
if (console.debug) {
console.debug(name, evt);
} else if (console) {
console.log("DEBUG:", name, evt);
} else {
throw "NO CONSOLE SUPPORTED"
}
}
});