Table of Contents

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

shouldBlock Func<NavigationAttempt, bool>

Function that receives a navigation attempt and returns true to block.

state RouteBlockerState

State 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

shouldBlock Func<NavigationAttempt, CancellationToken, UniTask<bool>>

Async function that receives a navigation attempt and returns true to block.

state RouteBlockerState

State object for this blocker. Block(NavigationAttempt) is invoked when blocking.

Returns

IDisposable