Skip to content

Releases: maddalax/htmgo

v0.3.5

11 Oct 14:19
Compare
Choose a tag to compare
  1. Updated OnLoad event handler to always be called on any element (not just browser supported ones such as Script, Body, Img, etc)
    This means if you need run a command / eval js against a specific element when it loads in (on initial load or even after swap), you can do so.

Example:

h.Div(
    h.OnLoad(
        js.EvalJs(`self.focus()`)
    )
)

You can reference the current element using 'self' or 'element' if you are evaluating JS on a parent or sibling.

  1. Removed usage of html.EscapeString on GetPartialPathWithQs

v0.3.4

09 Oct 15:42
Compare
Choose a tag to compare

What's Changed

  1. Update watcher to include newly added directories
  2. Fix GetPartialPath 404ing if calling it from a nested route (#17) thanks @Pitasi
  3. Add a few utility methods to h.RequestContext
func (c *RequestContext) FormValue(key string)
func (c *RequestContext) Header(key string)
func (c *RequestContext) UrlParam(key string) 
func (c *RequestContext) QueryParam(key string)
func (c *RequestContext) IsBoosted() bool 
func (c *RequestContext) IsHxRequest() bool
func (c *RequestContext) HxPromptResponse() 
func (c *RequestContext) HxTargetId() 
func (c *RequestContext) HxTriggerName() 
func (c *RequestContext) HxTriggerId() 
func (c *RequestContext) HxCurrentBrowserUrl()

Also added

func GetRequestContext(r *http.Request) *RequestContext {
	return r.Context().Value(RequestContextKey).(*RequestContext)
}

Usage:

app.Router.Get("/test", func(writer http.ResponseWriter, request *http.Request) {
	ctx := h.GetRequestContext(request)
})

For if you need to get the h.RequestContext from an http.Request. This is useful if you are doing your own routing but still want to use h.RequestContext to pass to other things such as partials or other pages.

Full Changelog: v0.3.3...v0.3.4

v0.3.3

04 Oct 17:03
Compare
Choose a tag to compare
  1. Released SSE suppport
  2. Moved h.RequestContext embedded 'Request' to ctx.Request, also added ctx.Response
  3. Added multiple new methods for event handlers for SSE

v0.3.2

30 Sep 18:10
Compare
Choose a tag to compare

What's Changed

  • Update attribute methods to use an ordered map so we can have deterministic output by @maddalax in #12

Full Changelog: v0.3.1...v0.3.2

v0.3.1

29 Sep 14:11
Compare
Choose a tag to compare
  1. Added multiple new JS commands
  • SetTextOnChildren
  • SetClassOnChildren
  • RemoveClassOnChildren
  • SetClassOnSibling
  • RemoveClassOnSibling
  • SubmitFormOnEnter
  1. Added more common attributes

  2. Adding html escaping when rendering using Text()

  3. Renamed Raw to UnsafeRaw to signify it does not do html escaping

v0.3.0

28 Sep 18:08
Compare
Choose a tag to compare

What's Changed

v0.2.0

26 Sep 17:07
Compare
Choose a tag to compare
  1. Fixed issues with the watch server not killing processes well enough