mirror of
https://github.com/bigskysoftware/htmx.git
synced 2025-10-02 15:25:26 +00:00
include request configuration in events
fixes https://github.com/bigskysoftware/htmx/issues/201
This commit is contained in:
parent
f984abb76d
commit
885596de09
@ -18,13 +18,13 @@
|
||||
htmx.defineExtension('path-deps', {
|
||||
onEvent: function (name, evt) {
|
||||
if (name === "htmx:afterRequest") {
|
||||
var xhr = evt.detail.xhr;
|
||||
var config = evt.detail.requestConfig;
|
||||
// mutating call
|
||||
if (xhr.method !== "GET") {
|
||||
if (config.verb !== "get") {
|
||||
var eltsWithDeps = htmx.findAll("[path-deps]");
|
||||
for (var i = 0; i < eltsWithDeps.length; i++) {
|
||||
var elt = eltsWithDeps[i];
|
||||
if (dependsOn(elt.getAttribute('path-deps'), xhr.url)) {
|
||||
if (dependsOn(elt.getAttribute('path-deps'), config.path)) {
|
||||
htmx.trigger(elt, "path-deps");
|
||||
}
|
||||
}
|
||||
|
@ -1721,7 +1721,7 @@ return (function () {
|
||||
}
|
||||
}
|
||||
|
||||
var eventDetail = {xhr: xhr, target: target};
|
||||
var eventDetail = {xhr: xhr, target: target, requestConfig:requestConfig};
|
||||
xhr.onload = function () {
|
||||
try {
|
||||
if (!triggerEvent(elt, 'htmx:beforeOnLoad', eventDetail)) return;
|
||||
|
Loading…
x
Reference in New Issue
Block a user