Skip to main content Link Search Menu Expand Document (external link)

CurrentRoute overview

Added in v1.0.0


Table of contents


utils

CurrentParams

Signature

export declare const CurrentParams: Fx.RefSubject.Filtered<
  Readonly<Record<string, string | readonly string[]>>,
  never,
  Navigation.Navigation | CurrentRoute
>

Added in v1.0.0

CurrentRoute

Signature

export declare const CurrentRoute: Context.Tagged<CurrentRoute, CurrentRoute>

Added in v1.0.0

CurrentRoute (interface)

Signature

export interface CurrentRoute {
  readonly route: Route.Route.Any
  readonly parent: Option.Option<CurrentRoute>
}

Added in v1.0.0

CurrentSearchParams

Signature

export declare const CurrentSearchParams: Fx.RefSubject.Computed<URLSearchParams, never, Navigation.Navigation>

Added in v1.0.0

CurrentState

Signature

export declare const CurrentState: Fx.RefSubject.Computed<unknown, never, Navigation.Navigation>

Added in v1.0.0

Signature

export type NavigateOptions<R extends Route.Route.Any> =
  Route.Route.ParamsAreOptional<R> extends true
    ? [
        options?: Navigation.NavigateOptions & {
          readonly params?: Route.Route.Params<R> | undefined
        } & {
          readonly relative?: boolean
        }
      ]
    : [
        options: Navigation.NavigateOptions & {
          readonly params: Route.Route.Params<R>
        } & {
          readonly relative?: boolean
        }
      ]

Added in v1.0.0

browser

Signature

export declare const browser: Layer.Layer<CurrentRoute, never, Document.Document>

Added in v1.0.0

decode

Signature

export declare function decode<R extends Route.Route.Any>(
  route: R
): Fx.RefSubject.Filtered<
  Route.Route.Type<R>,
  Route.RouteDecodeError<R>,
  Navigation.Navigation | CurrentRoute | Route.Route.Context<R>
>

Added in v1.0.0

isActive

Signature

export declare function isActive<R extends Route.Route.Any>(
  route: R,
  ...[params]: Route.Route.ParamsList<R>
): RefSubject.Computed<boolean, never, Navigation.Navigation | CurrentRoute>
export declare function isActive<R extends Route.Route.Any>(
  route: R,
  params: Route.Route.Params<R>
): RefSubject.Computed<boolean, never, Navigation.Navigation | CurrentRoute>

Added in v1.0.0

layer

Signature

export declare function layer<R extends Route.Route.Any>(
  route: R,
  parent: Option.Option<CurrentRoute> = Option.none()
): Layer.Layer<CurrentRoute>

Added in v1.0.0

makeCurrentRoute

Signature

export declare function makeCurrentRoute<R extends Route.Route.Any>(
  route: R,
  parent: Option.Option<CurrentRoute> = Option.none()
): CurrentRoute

Added in v1.0.0

makeHref

Signature

export declare function makeHref<const R extends Route.Route.Any>(
  route: R,
  ...[params]: Route.Route.ParamsList<R>
): RefSubject.Filtered<string, never, Navigation.Navigation | CurrentRoute>
export declare function makeHref<const R extends Route.Route.Any>(
  route: R,
  params: Route.Route.Params<R>
): RefSubject.Filtered<string, never, Navigation.Navigation | CurrentRoute>

Added in v1.0.0

Signature

export declare const navigate: <R extends Route.Route.Any>(
  route: R,
  ...[options]: NavigateOptions<R>
) => Effect.Effect<
  Navigation.Destination,
  Navigation.NavigationError | Cause.NoSuchElementException,
  Navigation.Navigation | CurrentRoute
>

Added in v1.0.0

server

Signature

export declare const server: (base?: string) => Layer.Layer<CurrentRoute>

Added in v1.0.0

withCurrentRoute

Signature

export declare const withCurrentRoute: {
  <R extends Route.Route.Any>(
    route: R
  ): <A, E, R>(effect: Effect.Effect<A, E, R>) => Effect.Effect<A, E, Exclude<R, CurrentRoute>>
  <A, E, R, R_ extends Route.Route.Any>(
    effect: Effect.Effect<A, E, R>,
    route: R_
  ): Effect.Effect<A, E, Exclude<R, CurrentRoute>>
}

Added in v1.0.0