LiveRouteSetup
class LiveRouteSetup[A, P]A route being registered: layouts, connected-turn guards, connected resources, and mount aspects, in any order, then the LiveView it mounts.
A LiveRoute is itself a registration with no setup, so Routes.search -> SearchLiveView()
registers it directly. Each setup call returns a new registration and leaves the route value
unchanged. See the routes guide.
Type parameters
Athe values decoded from the path, which layouts receive
Pthe parameters a LiveView.Routed receives
Defined by scalive.LiveRouteSetup. View source (scalive/api/src/scalive/routing/LiveRouting.scala:209-362)
Methods8
->
def ->: [View](view: => View)(using mount: LiveRouteView[View, P])(LiveRegistration[Any] { type Input = Any })Registers the LiveView this route mounts, as in Routes.counter -> CounterLiveView().
view is evaluated for the disconnected render and again for each connected mount. Use
from when the LiveView needs services, and context when it reads session context.
Defined by scalive.LiveRouteSetup.->. View source (scalive/api/src/scalive/routing/LiveRouting.scala:296-301)
context
def context: [Ctx, View](factory: Ctx => View)(using mount: LiveRouteView[View, P])(LiveRegistration[Any] { type Input = Ctx })Registers a LiveView built from the context of the named live session around this route.
The route compiles only inside a session that produces Ctx, as in
.context((user: CurrentUser) => AccountLiveView(user)). Inside the session, a tuple context
arrives as separate parameters, as in .context((user, locale) => ...). See live
sessions.
Defined by scalive.LiveRouteSetup.context. View source (scalive/api/src/scalive/routing/LiveRouting.scala:324-332)
from
def from: [Ctx, R, View](factory: Ctx => zio.package.URIO[R, View])(using mount: LiveRouteView[View, P])(LiveRegistration[R] { type Input = Ctx })Registers a LiveView built from services in the application environment.
This form also reads the context of the enclosing named live session, as in
from((user: CurrentUser) => ZIO.serviceWith[Reports](ReportsLiveView(user, _))).
Defined by scalive.LiveRouteSetup.from. View source (scalive/api/src/scalive/routing/LiveRouting.scala:339-344)
def from: [R, View](factory: zio.package.URIO[R, View])(using mount: LiveRouteView[View, P])(LiveRegistration[R] { type Input = Any })Registers a LiveView built from services in the application environment.
The route adds R to the application's environment requirement, so the server must provide
it, as in from(ZIO.serviceWith[Reports](ReportsLiveView(_))). Scalive runs factory for the
disconnected render and for each connected mount. See the services
guide.
Defined by scalive.LiveRouteSetup.from. View source (scalive/api/src/scalive/routing/LiveRouting.scala:310-315)
guardConnectedTurns
def guardConnectedTurns[Result <: Unit](guard: Any => zio.package.IO[LiveConnectedTurnFailure, Result]): LiveRouteSetup[A, P]Appends a policy check before each connected application turn.
Guards at one boundary run in declaration order; session guards run before route guards.
Succeed with Unit to continue, or fail with LiveConnectedTurnFailure for a controlled
halt, redirect, reload, or disconnect. Guards are inherited by nested LiveViews and do not run
during mount, disconnected rendering, or framework cleanup.
Defined by scalive.LiveRouteSetup.guardConnectedTurns. View source (scalive/api/src/scalive/routing/LiveRouting.scala:253-256)
withConnectedResources
def withConnectedResources[Result <: Unit](initialize: (Any, ConnectedResources) => zio.package.Task[Result]): LiveRouteSetup[A, P]Appends setup for this route's connected resources, before connected mount.
Callbacks run in declaration order, after session setup. They do not run during disconnected rendering and are not inherited by nested LiveViews.
Defined by scalive.LiveRouteSetup.withConnectedResources. View source (scalive/api/src/scalive/routing/LiveRouting.scala:263-268)
withLayout
def withLayout(layout: LiveLayout[A, Any]): LiveRouteSetup[A, P]Wraps this route's LiveView in layout.
Route layouts sit inside router and session layouts and nest in installation order. See the layouts guide.
Defined by scalive.LiveRouteSetup.withLayout. View source (scalive/api/src/scalive/routing/LiveRouting.scala:238-239)
withMountAspect
def withMountAspect[R, In, Out, Result](aspect: LiveRouteMountAspect[R, A, In, Out])(using append: ContextAppend.Aux[In, Out, Result]): LiveRouteSetup.WithContext[R, A, P, In, Result]Runs aspect before this route mounts and passes its output to the LiveView's factory.
The aspect receives the route's parameters and URL, and In, the context of the enclosing
named live session. See route mount
aspects.
Defined by scalive.LiveRouteSetup.withMountAspect. View source (scalive/api/src/scalive/routing/LiveRouting.scala:276-289)
withRootLayout
def withRootLayout(layout: LiveRootLayout[A, Any]): LiveRouteSetup[A, P]Renders this route's document with layout, replacing the session's or router's root layout.
Defined by scalive.LiveRouteSetup.withRootLayout. View source (scalive/api/src/scalive/routing/LiveRouting.scala:243-244)