htmx

package
v0.14.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBoosted

func GetBoosted(r *http.Request) bool

GetBoosted indicates that the request is via an element using hx-boost.

func GetCurrentURL

func GetCurrentURL(r *http.Request) string

GetCurrentURL is the current URL of the browser.

func GetHistoryRestoreRequest

func GetHistoryRestoreRequest(r *http.Request) bool

GetHistoryRestoreRequest returns true if the request is for history restoration after a miss in the local history cache.

func GetPrompt

func GetPrompt(r *http.Request) string

GetPrompt is the user response to an hx-prompt.

func GetRequest

func GetRequest(r *http.Request) bool

GetRequest indicates that it is a HTMX request.

func GetTarget

func GetTarget(r *http.Request) string

GetTarget is the id of the target element if it exists.

func GetTrigger

func GetTrigger(r *http.Request) string

GetTrigger is the id of the triggered element if it exists.

func GetTriggerName

func GetTriggerName(r *http.Request) string

GetTriggerName is the name of the triggered element if it exists.

func Join

func Join(s ...string) string

func SetLocation

func SetLocation(w http.ResponseWriter, url string)

SetLocation allows you to do a client-side redirect that does not do a full page reload.

func SetPushURL

func SetPushURL(w http.ResponseWriter)

SetPushURL pushes a new url into the history stack.

func SetRedirect

func SetRedirect(w http.ResponseWriter, url string)

SetRedirect used to do a client-side redirect to a new location.

func SetRefresh

func SetRefresh(w http.ResponseWriter)

SetRefresh will do a client-side full refresh of the page.

func SetReplaceURL

func SetReplaceURL(w http.ResponseWriter, url string)

SetReplaceURL replaces the current URL in the location bar.

func SetReselect

func SetReselect(w http.ResponseWriter)

SetReselect is a CSS selector that allows you to choose which part of the response is used to be swapped in.

func SetReswap

func SetReswap(w http.ResponseWriter)

SetReswap allows you to specify how the response will be swapped.

func SetRetarget

func SetRetarget(w http.ResponseWriter, target string)

SetRetarget is a CSS selector that updates the target of the content update to a different element on the page.

func SetTrigger

func SetTrigger(w http.ResponseWriter, event string)

SetTrigger events as soon as the response is received.

func SetTriggerAfterSettle

func SetTriggerAfterSettle(w http.ResponseWriter, event string)

SetTriggerAfterSettle events after the settling step.

func SetTriggerAfterSwap

func SetTriggerAfterSwap(w http.ResponseWriter, event string)

SetTriggerAfterSwap events after the swap step.

Types

type Event

type Event struct {
	Key   string
	Value any
}

func NewEvent added in v0.14.0

func NewEvent(key string, value any) Event

func NewEventString added in v0.14.0

func NewEventString(key string) Event

func (Event) FromBody

func (e Event) FromBody() string

func (Event) SetTrigger

func (e Event) SetTrigger(w http.ResponseWriter)

func (Event) SetTriggerAfterSettle

func (e Event) SetTriggerAfterSettle(w http.ResponseWriter)

func (Event) SetTriggerAfterSwap

func (e Event) SetTriggerAfterSwap(w http.ResponseWriter)

func (Event) String added in v0.14.0

func (e Event) String() string

type Events added in v0.14.0

type Events []Event

func MultipleEvents added in v0.14.0

func MultipleEvents(events ...Event) Events

func (Events) SetTrigger added in v0.14.0

func (es Events) SetTrigger(w http.ResponseWriter)

func (Events) SetTriggerAfterSettle added in v0.14.0

func (es Events) SetTriggerAfterSettle(w http.ResponseWriter)

func (Events) SetTriggerAfterSwap added in v0.14.0

func (es Events) SetTriggerAfterSwap(w http.ResponseWriter)

func (Events) String added in v0.14.0

func (es Events) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL