Method Register
- Namespace
- Velvet
- Assembly
- Velvet.Docs.dll
Register(Func<NavigationAttempt, bool>, RouteBlockerState)
Registers a synchronous Blocker. Disposing the returned System.IDisposable unregisters it.
public IDisposable Register(Func<NavigationAttempt, bool> shouldBlock, RouteBlockerState state)
Parameters
shouldBlockFunc<NavigationAttempt, bool>Function that receives a navigation attempt and returns true to block.
stateRouteBlockerStateState object for this blocker. Block(NavigationAttempt) is invoked when blocking.
Returns
- IDisposable
Register(Func<NavigationAttempt, CancellationToken, UniTask<bool>>, RouteBlockerState)
Registers an asynchronous Blocker. Disposing the returned System.IDisposable unregisters it.
public IDisposable Register(Func<NavigationAttempt, CancellationToken, UniTask<bool>> shouldBlock, RouteBlockerState state)
Parameters
shouldBlockFunc<NavigationAttempt, CancellationToken, UniTask<bool>>Async function that receives a navigation attempt and returns true to block.
stateRouteBlockerStateState object for this blocker. Block(NavigationAttempt) is invoked when blocking.
Returns
- IDisposable