Method NavigateAsync
- Namespace
- Velvet
- Assembly
- Velvet.Docs.dll
NavigateAsync(string, NavigationMode, CancellationToken)
Navigates to the given path. Evaluation order is Guard -> Blocker -> Loader. When a Guard returns a redirect, recursively navigates to the redirect target with NavigationMode.Replace (the original path is not pushed onto the history). Up to 5 redirects.
public UniTask<NavigationResult> NavigateAsync(string path, NavigationMode mode = NavigationMode.Push, CancellationToken cancellationToken = default)
Parameters
pathstringTarget path to navigate to.
modeNavigationModeHow the destination is recorded in the history stack. Defaults to Push.
cancellationTokenCancellationTokenToken observed by Guards, Blockers, and Loaders to abort the navigation.
Returns
- UniTask<NavigationResult>
A NavigationResult indicating the outcome: Success on completion, NotFound when no route matches, Blocked when a Blocker rejects the attempt, Cancelled when concurrent navigation or the cancellation token aborts it, or Error on Loader failure or redirect overflow.
NavigateAsync(string, NavigationMode, int, CancellationToken)
Navigates with relative resolution anchored to a specific matched-route level
(baseRouteIndex), so a .. is interpreted relative to the route the
caller is rendered in rather than the leaf route. UseNavigate/V.Navigate pass the
caller's Outlet depth here so a relative target anchors at the caller's route level;
-1 falls back to the leaf route.
public UniTask<NavigationResult> NavigateAsync(string path, NavigationMode mode, int baseRouteIndex, CancellationToken cancellationToken = default)
Parameters
pathstringmodeNavigationModebaseRouteIndexintcancellationTokenCancellationToken
Returns
- UniTask<NavigationResult>