Skip to content

v10.0.0

Compare
Choose a tag to compare
@maxence-charriere maxence-charriere released this 20 May 06:50
· 32 commits to master since this release

Go-app v10.0.0 is out!

Install

go get -u github.com/maxence-charriere/go-app/v10

Changelog

General

  • The engine has been rewritten to be more maintainable and efficient.
  • .wasm updates are now better handled, addressing cases where the service worker is updated before the .wasm file is loaded.

Route

  • Route functions now take a func() app.Composer parameter:
    app.Route("/hello", func() app.Composer{
        return &helloCompnent{}
    })
  • RouteFunc functions have been removed.
  • The previous Route behavior can be reproduced by using app.NewZeroComponentFactory as the Route parameter:
    app.Route("/hello", app.NewZeroComponentFactory(&helloCompnent{}))

Conditions

  • app.If, app.ElseIf and app.Else now take functions:
    app.If(true, func() app.UI{
        return app.Text("true")
    })
  • Added app.IfSlice, app.ElseIfSlice and app.ElseSlice to handle cases where a function needs to return []app.UI.
    app.IfSlice(true, func() []app.UI{
        return []app.UI{app.Text("true")}
    })

States

  • Context.SetState now uses function chaining to specify options:
    ctx.SetState("ageState", 42).
        Persist().
        ExpiresIn(time.Hour)