Skip to main content

getOrInitRootChaynsHistoryLayer

Callable


  • Returns the singleton root ChaynsHistoryLayer for the current window. Creates it on first call; subsequent calls return the same instance.


    Parameters

    • optionalurl: string

      On SSR, pass the current request URL (e.g. req.url or router.asPath) so child layers receive the correct initial route segments. Ignored after first call.

    • optionalsegmentCount: number

      Number of URL segments the root layer owns. When provided the segments are resolved from the URL immediately so getRoute() is populated on the very first render without any subsequent setSegmentCount call. Ignored after first call.

    Returns InitRootChaynsHistoryLayerResult