This commit is contained in:
carson 2020-05-12 10:07:33 -07:00
parent f328a71c5d
commit 2897947f44

View File

@ -8,7 +8,7 @@ title: </> kutty - high power tools for html
Kutty provides an extensive events system that can be used to modify and enhance behavior. Events Kutty provides an extensive events system that can be used to modify and enhance behavior. Events
are listed below. are listed below.
### <a name="afterOnLoad.kutty"></a> Event: [`afterOnLoad.kutty`](#afterOnLoad.kutty) ### <a name="afterOnLoad.kutty"></a> Event - [`afterOnLoad.kutty`](#afterOnLoad.kutty)
This event is triggered after an AJAX `onload` has finished. Note that this does not mean that the content This event is triggered after an AJAX `onload` has finished. Note that this does not mean that the content
has been swapped or settled yet, only that the request has finished. has been swapped or settled yet, only that the request has finished.
@ -19,7 +19,7 @@ has been swapped or settled yet, only that the request has finished.
* `detail.xhr` - the `XMLHttpRequest` * `detail.xhr` - the `XMLHttpRequest`
* `detail.target` - the target of the request * `detail.target` - the target of the request
### <a name="afterSettle.kutty"></a> Event: [`afterSettle.kutty`](#afterSettle.kutty) ### <a name="afterSettle.kutty"></a> Event - [`afterSettle.kutty`](#afterSettle.kutty)
This event is triggered after the DOM has [settled](/docs#settling). This event is triggered after the DOM has [settled](/docs#settling).
@ -29,7 +29,7 @@ This event is triggered after the DOM has [settled](/docs#settling).
* `detail.xhr` - the `XMLHttpRequest` * `detail.xhr` - the `XMLHttpRequest`
* `detail.target` - the target of the request * `detail.target` - the target of the request
### <a name="afterSwap.kutty"></a> Event: [`afterSwap.kutty`](#afterSwap.kutty) ### <a name="afterSwap.kutty"></a> Event - [`afterSwap.kutty`](#afterSwap.kutty)
This event is triggered after new content has been [swapped into the DOM](/docs#swapping). This event is triggered after new content has been [swapped into the DOM](/docs#swapping).
@ -39,7 +39,7 @@ This event is triggered after new content has been [swapped into the DOM](/docs
* `detail.xhr` - the `XMLHttpRequest` * `detail.xhr` - the `XMLHttpRequest`
* `detail.target` - the target of the request * `detail.target` - the target of the request
### <a name="beforeOnLoad.kutty"></a> Event: [`beforeOnLoad.kutty`](#beforeOnLoad.kutty) ### <a name="beforeOnLoad.kutty"></a> Event - [`beforeOnLoad.kutty`](#beforeOnLoad.kutty)
This event is triggered before any new content has been [swapped into the DOM](/docs#swapping). If This event is triggered before any new content has been [swapped into the DOM](/docs#swapping). If
the event is cancelled, no swap will occur. the event is cancelled, no swap will occur.
@ -50,7 +50,7 @@ the event is cancelled, no swap will occur.
* `detail.xhr` - the `XMLHttpRequest` * `detail.xhr` - the `XMLHttpRequest`
* `detail.target` - the target of the request * `detail.target` - the target of the request
### <a name="beforeRequest.kutty"></a> Event: [`beforeRequest.kutty`](#beforeRequest.kutty) ### <a name="beforeRequest.kutty"></a> Event - [`beforeRequest.kutty`](#beforeRequest.kutty)
This event is triggered before an AJAX request is issued. If the event is cancelled, no request will occur. This event is triggered before an AJAX request is issued. If the event is cancelled, no request will occur.
@ -60,7 +60,7 @@ This event is triggered before an AJAX request is issued. If the event is cance
* `detail.xhr` - the `XMLHttpRequest` * `detail.xhr` - the `XMLHttpRequest`
* `detail.target` - the target of the request * `detail.target` - the target of the request
### <a name="historyCacheMiss.kutty"></a> Event: [`historyCacheMiss.kutty`](#historyCacheMiss.kutty) ### <a name="historyCacheMiss.kutty"></a> Event - [`historyCacheMiss.kutty`](#historyCacheMiss.kutty)
This event is triggered when a cache miss occurs when restoring history This event is triggered when a cache miss occurs when restoring history
@ -69,7 +69,7 @@ This event is triggered when a cache miss occurs when restoring history
* `detail.xhr` - the `XMLHttpRequest` that will retrieve the remote content for restoration * `detail.xhr` - the `XMLHttpRequest` that will retrieve the remote content for restoration
* `detail.path` - the path and query of the page being restored * `detail.path` - the path and query of the page being restored
### <a name="historyCacheMissLoad.kutty"></a> Event: [`historyCacheMissLoad.kutty`](#historyCacheMissLoad.kutty) ### <a name="historyCacheMissLoad.kutty"></a> Event - [`historyCacheMissLoad.kutty`](#historyCacheMissLoad.kutty)
This event is triggered when a cache miss occurs and a response has been retrieved succesfully from the server This event is triggered when a cache miss occurs and a response has been retrieved succesfully from the server
for the content to restore for the content to restore
@ -79,7 +79,7 @@ for the content to restore
* `detail.xhr` - the `XMLHttpRequest` * `detail.xhr` - the `XMLHttpRequest`
* `detail.path` - the path and query of the page being restored * `detail.path` - the path and query of the page being restored
### <a name="historyCacheMissError.kutty"></a> Event: [`historyCacheMissError.kutty`](#historyCacheMissError.kutty) ### <a name="historyCacheMissError.kutty"></a> Event - [`historyCacheMissError.kutty`](#historyCacheMissError.kutty)
This event is triggered when a cache miss occurs and a response has been retrieved from the server This event is triggered when a cache miss occurs and a response has been retrieved from the server
for the content to restore, but the response is an error (e.g. `404`) for the content to restore, but the response is an error (e.g. `404`)
@ -89,7 +89,7 @@ for the content to restore, but the response is an error (e.g. `404`)
* `detail.xhr` - the `XMLHttpRequest` * `detail.xhr` - the `XMLHttpRequest`
* `detail.path` - the path and query of the page being restored * `detail.path` - the path and query of the page being restored
### <a name="historyRestore.kutty"></a> Event: [`historyRestore.kutty`](#historyRestore.kutty) ### <a name="historyRestore.kutty"></a> Event - [`historyRestore.kutty`](#historyRestore.kutty)
This event is triggered when kutty handles a history restoration action This event is triggered when kutty handles a history restoration action
@ -97,7 +97,7 @@ This event is triggered when kutty handles a history restoration action
* `detail.path` - the path and query of the page being restored * `detail.path` - the path and query of the page being restored
### <a name="historyUpdate.kutty"></a> Event: [`historyUpdate.kutty`](#historyUpdate.kutty) ### <a name="historyUpdate.kutty"></a> Event - [`historyUpdate.kutty`](#historyUpdate.kutty)
This event is triggered when kutty handles a history restoration action This event is triggered when kutty handles a history restoration action
@ -106,7 +106,7 @@ This event is triggered when kutty handles a history restoration action
* `detail.path` - the path and query of the page being restored * `detail.path` - the path and query of the page being restored
* `detail.historyElt` - the history element being restored into * `detail.historyElt` - the history element being restored into
### <a name="initSSE.kutty"></a> Event: [`initSSE.kutty`](#initSSE.kutty) ### <a name="initSSE.kutty"></a> Event - [`initSSE.kutty`](#initSSE.kutty)
This event is triggered when kutty initializes a new SSE source. It can be used This event is triggered when kutty initializes a new SSE source. It can be used
to [configure the source](https://developer.mozilla.org/en-US/docs/Web/API/EventSource/EventSource). to [configure the source](https://developer.mozilla.org/en-US/docs/Web/API/EventSource/EventSource).
@ -117,7 +117,7 @@ Note that by default `withCredentials` will be set to `true` in the configuratio
* `detail.config` - the config that will be passed to the `EventSource` contstructor * `detail.config` - the config that will be passed to the `EventSource` contstructor
### <a name="load.kutty"></a> Event: [`load.kutty`](#load.kutty) ### <a name="load.kutty"></a> Event - [`load.kutty`](#load.kutty)
This event is triggered when a new node is loaded into the DOM by kutty. This event is triggered when a new node is loaded into the DOM by kutty.
@ -125,7 +125,7 @@ This event is triggered when a new node is loaded into the DOM by kutty.
* `detail.elt` - the newly added element * `detail.elt` - the newly added element
### <a name="noSSESourceError.kutty"></a> Event: [`noSSESourceError.kutty`](#noSSESourceError.kutty) ### <a name="noSSESourceError.kutty"></a> Event - [`noSSESourceError.kutty`](#noSSESourceError.kutty)
This event is triggered when an element refers to a SSE event in its trigger, but no parent SSE source has been defined This event is triggered when an element refers to a SSE event in its trigger, but no parent SSE source has been defined
@ -133,7 +133,7 @@ This event is triggered when an element refers to a SSE event in its trigger, bu
* `detail.elt` - the element with the bad SSE trigger * `detail.elt` - the element with the bad SSE trigger
### <a name="onLoadError.kutty"></a> Event: [`onLoadError.kutty`](#onLoadError.kutty) ### <a name="onLoadError.kutty"></a> Event - [`onLoadError.kutty`](#onLoadError.kutty)
This event is triggered when an error occurs during the `load` handling of an AJAX call This event is triggered when an error occurs during the `load` handling of an AJAX call
@ -144,7 +144,7 @@ This event is triggered when an error occurs during the `load` handling of an AJ
* `detail.target` - the target of the request * `detail.target` - the target of the request
* `detail.exception` - the exception that occurred * `detail.exception` - the exception that occurred
### <a name="oobErrorNoTarget.kutty"></a> Event: [`oobErrorNoTarget.kutty`](#oobErrorNoTarget.kutty) ### <a name="oobErrorNoTarget.kutty"></a> Event - [`oobErrorNoTarget.kutty`](#oobErrorNoTarget.kutty)
This event is triggered when an [out of band swap](/docs##oob_swaps) does not have a corresponding element This event is triggered when an [out of band swap](/docs##oob_swaps) does not have a corresponding element
in the DOM to switch with. in the DOM to switch with.
@ -153,7 +153,7 @@ in the DOM to switch with.
* `detail.content` - the element with the bad oob `id` * `detail.content` - the element with the bad oob `id`
### <a name="prompt.kutty"></a> Event: [`prompt.kutty`](#prompt.kutty) ### <a name="prompt.kutty"></a> Event - [`prompt.kutty`](#prompt.kutty)
This event is triggered after a prompt has been shown to the user with the [`kt-prompt`](/attributes/kt-prompt) This event is triggered after a prompt has been shown to the user with the [`kt-prompt`](/attributes/kt-prompt)
attribute. If this event is cancelled, the AJAX request will not occur. attribute. If this event is cancelled, the AJAX request will not occur.
@ -164,7 +164,7 @@ attribute. If this event is cancelled, the AJAX request will not occur.
* `detail.target` - the target of the request * `detail.target` - the target of the request
* `detail.prompt` - the user response to the prompt * `detail.prompt` - the user response to the prompt
### <a name="responseError.kutty"></a> Event: [`responseError.kutty`](#responseError.kutty) ### <a name="responseError.kutty"></a> Event - [`responseError.kutty`](#responseError.kutty)
This event is triggered when an HTTP error response occurs This event is triggered when an HTTP error response occurs
@ -174,7 +174,7 @@ This event is triggered when an HTTP error response occurs
* `detail.elt` - the element that triggered the request * `detail.elt` - the element that triggered the request
* `detail.target` - the target of the request * `detail.target` - the target of the request
### <a name="sendError.kutty"></a> Event: [`sendError.kutty`](#sendError.kutty) ### <a name="sendError.kutty"></a> Event - [`sendError.kutty`](#sendError.kutty)
This event is triggered when a network error prevents an HTTP request from occurring This event is triggered when a network error prevents an HTTP request from occurring
@ -184,7 +184,7 @@ This event is triggered when a network error prevents an HTTP request from occur
* `detail.elt` - the element that triggered the request * `detail.elt` - the element that triggered the request
* `detail.target` - the target of the request * `detail.target` - the target of the request
### <a name="sseError.kutty"></a> Event: [`sseError.kutty`](#sseError.kutty) ### <a name="sseError.kutty"></a> Event - [`sseError.kutty`](#sseError.kutty)
This event is triggered when an error occurs with a SSE source This event is triggered when an error occurs with a SSE source
@ -194,7 +194,7 @@ This event is triggered when an error occurs with a SSE source
* `detail.error` - the error * `detail.error` - the error
* `detail.source` - the SSE source * `detail.source` - the SSE source
### <a name="swapError.kutty"></a> Event: [`swapError.kutty`](#swapError.kutty) ### <a name="swapError.kutty"></a> Event - [`swapError.kutty`](#swapError.kutty)
This event is triggered when an error occurs during the swap phase This event is triggered when an error occurs during the swap phase
@ -204,7 +204,7 @@ This event is triggered when an error occurs during the swap phase
* `detail.elt` - the element that triggered the request * `detail.elt` - the element that triggered the request
* `detail.target` - the target of the request * `detail.target` - the target of the request
### <a name="parameters.kutty"></a> Event: [`parameters.kutty`](#parameters.kutty) ### <a name="parameters.kutty"></a> Event - [`parameters.kutty`](#parameters.kutty)
This event is triggered after kutty has collected parameters for inclusion in the request. It can be This event is triggered after kutty has collected parameters for inclusion in the request. It can be
used to include or update the parameters that kutty will send: used to include or update the parameters that kutty will send: