aboutsummaryrefslogtreecommitdiff
path: root/static/js/ext/debug.js
diff options
context:
space:
mode:
Diffstat (limited to 'static/js/ext/debug.js')
-rw-r--r--static/js/ext/debug.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/static/js/ext/debug.js b/static/js/ext/debug.js
new file mode 100644
index 0000000..aa88c9e
--- /dev/null
+++ b/static/js/ext/debug.js
@@ -0,0 +1,15 @@
+if (htmx.version && !htmx.version.startsWith("1.")) {
+ console.warn("WARNING: You are using an htmx 1 extension with htmx " + htmx.version +
+ ". It is recommended that you move to the version of this extension found on https://htmx.org/extensions")
+}
+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"
+ }
+ }
+});