package http
import "maragu.dev/gomponents-htmx/http"
Package http provides helpers for working with HTMX HTTP requests. See https://htmx.org/reference/#headers
Index ¶
- func GetCurrentURL(headers http.Header) string
- func GetPrompt(headers http.Header) string
- func GetTarget(headers http.Header) string
- func GetTrigger(headers http.Header) string
- func GetTriggerName(headers http.Header) string
- func IsBoosted(headers http.Header) bool
- func IsHistoryRestoreRequest(headers http.Header) bool
- func IsRequest(headers http.Header) bool
- func SetLocation(headers http.Header, v string)
- func SetPushURL(headers http.Header, v string)
- func SetRedirect(headers http.Header, v string)
- func SetRefresh(headers http.Header)
- func SetReplaceURL(headers http.Header, v string)
- func SetReswap(headers http.Header, v string)
- func SetRetarget(headers http.Header, v string)
- func SetTrigger(headers http.Header, v string)
- func SetTriggerAfterSettle(headers http.Header, v string)
- func SetTriggerAfterSwap(headers http.Header, v string)
Examples ¶
Functions ¶
func GetCurrentURL ¶
GetCurrentURL of the browser.
func GetPrompt ¶
GetPrompt from the user response to an hx-prompt. See https://htmx.org/attributes/hx-prompt
func GetTarget ¶
GetTarget returns the id of the target element if it exists.
func GetTrigger ¶
GetTrigger returns the id of the triggered element if it exists.
func GetTriggerName ¶
GetTriggerName returns the name of the triggered element if it exists.
func IsBoosted ¶
IsBoosted indicates that the request is via an element using hx-boost.
func IsHistoryRestoreRequest ¶
IsHistoryRestoreRequest returns whether the request is for history restoration after a miss in the local history cache.
func IsRequest ¶
IsRequest returns whether this is a HTMX request.
func SetLocation ¶
SetLocation allows you to do a client-side redirect that does not do a full page reload. See https://htmx.org/headers/hx-location
func SetPushURL ¶
SetPushURL pushes a new URL into the history stack. See https://htmx.org/headers/hx-push-url
func SetRedirect ¶
SetRedirect can be used to do a client-side redirect to a new location.
func SetRefresh ¶
SetRefresh will make the client side do a a full refresh of the page.
func SetReplaceURL ¶
SetReplaceURL replaces the current URL in the location bar. See https://htmx.org/headers/hx-replace-url
func SetReswap ¶
SetReswap allows you to specify how the response will be swapped. See https://htmx.org/attributes/hx-swap
func SetRetarget ¶
SetRetarget sets a CSS selector that updates the target of the content update to a different element on the page.
func SetTrigger ¶
SetTrigger allows you to trigger client side events. See https://htmx.org/headers/hx-trigger
func SetTriggerAfterSettle ¶
SetTriggerAfterSettle allows you to trigger client side events. See https://htmx.org/headers/hx-trigger
func SetTriggerAfterSwap ¶
SetTriggerAfterSwap allows you to trigger client side events. See https://htmx.org/headers/hx-trigger
Source Files ¶
http.go
- Version
- v0.6.1 (latest)
- Published
- Oct 11, 2024
- Platform
- linux/amd64
- Imports
- 1 packages
- Last checked
- 1 month ago –
Tools for package owners.