htmx

package
v0.0.0-...-515d911 Latest Latest
Warning

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

Go to latest
Published: Dec 4, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsHTMX

func IsHTMX(r *http.Request) bool

IsHTMX returns bool indicating the presence of the "HX-Request" Request Header with a value of "true" This is useful in determining what and how to return

func Respond

func Respond(w http.ResponseWriter, r *http.Request, item interface{}, t string, block string)

Respond takes in the .gohtml template file(s), parses the template(s) and return the result to the client: if content-type is "application/json", it returns json if HX-Request is "true", it returns the HTMX fragment else it returns a full, stand alone page, if the block is "main"

func SSERespond

func SSERespond(item any, t string, block string, event string) (string, error)

SSERespond parses the template(s) and return an SSE formatted data block

func SendJson

func SendJson(w http.ResponseWriter, r *http.Request, item interface{})

Types

This section is empty.

Jump to

Keyboard shortcuts

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