diff options
Diffstat (limited to 'src/htmx.js')
-rw-r--r-- | src/htmx.js | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/htmx.js b/src/htmx.js index 71cc2352..46203a55 100644 --- a/src/htmx.js +++ b/src/htmx.js @@ -2593,7 +2593,7 @@ return (function () { return arr; } - function issueAjaxRequest(verb, path, elt, event, etc) { + function issueAjaxRequest(verb, path, elt, event, etc, confirmed) { var resolve = null; var reject = null; etc = etc != null ? etc : {}; @@ -2617,6 +2617,17 @@ return (function () { return; } + // allow event-based confirmation w/ a callback + if (!confirmed) { + var issueRequest = function() { + return issueAjaxRequest(verb, path, elt, event, etc, true); + } + var confirmDetails = {target: target, elt: elt, path: path, verb: verb, triggeringEvent: event, etc: etc, issueRequest: issueRequest}; + if (triggerEvent(elt, 'htmx:confirm', confirmDetails) === false) { + return; + } + } + var syncElt = elt; var eltData = getInternalData(elt); var syncStrategy = getClosestAttributeValue(elt, "hx-sync"); |