diff --git a/README.md b/README.md index c19261f..778334d 100644 --- a/README.md +++ b/README.md @@ -111,8 +111,8 @@ values. Define event triggers: - `htmx.Trigger(eventName string)` - A trigger with no details. -- `htmx.TriggerDetail(eventName string, detail string)` - A trigger with one detail value. -- `htmx.TriggerObject(eventName string, object any)` - A trigger with a JSON-serializable detail +- `htmx.TriggerDetail(eventName string, detailValue string)` - A trigger with one detail value. +- `htmx.TriggerObject(eventName string, detailObject any)` - A trigger with a JSON-serializable detail object. Recommended to pass in either `map[string]string` or structs with JSON field tags. Set trigger headers using the triggers above: diff --git a/respheaders.go b/respheaders.go index 5a262a5..2b3fb05 100644 --- a/respheaders.go +++ b/respheaders.go @@ -312,10 +312,10 @@ func Trigger(eventName string) triggerPlain { // HX-Trigger: {"showMessage":"Here Is A Message"} // // For more info, see https://htmx.org/headers/hx-trigger/ -func TriggerDetail(eventName string, detail string) triggerDetail { +func TriggerDetail(eventName string, detailValue string) triggerDetail { return triggerDetail{ eventName: eventName, - value: detail, + value: detailValue, } } @@ -335,10 +335,10 @@ func TriggerDetail(eventName string, detail string) triggerDetail { // HX-Trigger: {"showMessage":{"level" : "info", "message" : "Here Is A Message"}} // // For more info, see https://htmx.org/headers/hx-trigger/ -func TriggerObject(eventName string, object any) triggerObject { +func TriggerObject(eventName string, detailObject any) triggerObject { return triggerObject{ eventName: eventName, - object: object, + object: detailObject, } }