mirror of
https://github.com/bigskysoftware/htmx.git
synced 2025-09-27 04:50:43 +00:00
Add new event htmx:beforeHistoryUpdate (#1573)
* Add missing documentation for htmx:replacedInHistory * Add new event htmx:beforeHistoryUpdate
This commit is contained in:
parent
332e8986ac
commit
4f63581c55
@ -3535,6 +3535,7 @@ return (function () {
|
||||
|
||||
// if we need to save history, do so
|
||||
if (historyUpdate.type) {
|
||||
triggerEvent(getDocument().body, 'htmx:beforeHistoryUpdate', mergeObjects({ history: historyUpdate }, responseInfo));
|
||||
if (historyUpdate.type === "push") {
|
||||
pushUrlIntoHistory(historyUpdate.path);
|
||||
triggerEvent(getDocument().body, 'htmx:pushedIntoHistory', {path: historyUpdate.path});
|
||||
|
@ -344,6 +344,19 @@ attribute. If this event is cancelled, the AJAX request will not occur.
|
||||
* `detail.target` - the target of the request
|
||||
* `detail.prompt` - the user response to the prompt
|
||||
|
||||
### Event - `htmx:beforeHistoryUpdate` {#htmx:beforeHistoryUpdate}
|
||||
|
||||
This event is triggered before a history update is performed. It can be
|
||||
used to modify the `path` or `type` used to update the history.
|
||||
|
||||
##### Details
|
||||
|
||||
* `detail.history` - the `path` and `type` (push, replace) for the history update
|
||||
* `detail.elt` - the element that dispatched the request
|
||||
* `detail.xhr` - the `XMLHttpRequest`
|
||||
* `detail.target` - the target of the request
|
||||
* `detail.requestConfig` - the configuration of the AJAX request
|
||||
|
||||
### Event - `htmx:pushedIntoHistory` {#htmx:pushedIntoHistory}
|
||||
|
||||
This event is triggered after a URL has been pushed into history.
|
||||
@ -352,6 +365,14 @@ This event is triggered after a URL has been pushed into history.
|
||||
|
||||
* `detail.path` - the path and query of the URL that has been pushed into history
|
||||
|
||||
### Event - `htmx:replacedInHistory` {#htmx:replacedInHistory}
|
||||
|
||||
This event is triggered after a URL has been replaced in history.
|
||||
|
||||
##### Details
|
||||
|
||||
* `detail.path` - the path and query of the URL that has been replaced in history
|
||||
|
||||
### Event - `htmx:responseError` {#htmx:responseError}
|
||||
|
||||
This event is triggered when an HTTP error response occurs
|
||||
|
Loading…
x
Reference in New Issue
Block a user