Class ConfirmExitService
- Namespace
- NuvTools.AspNetCore.Blazor.JSInterop
- Assembly
- NuvTools.AspNetCore.Blazor.dll
Provides JavaScript interop functionality for confirming before the user leaves the page in Blazor applications.
public sealed class ConfirmExitService : IConfirmExitService, IAsyncDisposable
- Inheritance
-
ConfirmExitService
- Implements
- Inherited Members
Remarks
Initializes a new instance of the ConfirmExitService class.
Constructors
ConfirmExitService(IJSRuntime)
Provides JavaScript interop functionality for confirming before the user leaves the page in Blazor applications.
public ConfirmExitService(IJSRuntime jsRuntime)
Parameters
jsRuntimeIJSRuntimeThe JavaScript runtime for interop operations.
Remarks
Initializes a new instance of the ConfirmExitService class.
Properties
IsEnabled
Gets a value indicating whether the exit confirmation is currently active.
public bool IsEnabled { get; }
Property Value
Methods
DisableAsync(CancellationToken)
Deactivates the exit confirmation. Calling it while already inactive does nothing.
public ValueTask DisableAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenA cancellation token to observe.
Returns
DisposeAsync()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources asynchronously.
public ValueTask DisposeAsync()
Returns
- ValueTask
A task that represents the asynchronous dispose operation.
EnableAsync(CancellationToken)
Activates the exit confirmation. Calling it while already active does nothing.
public ValueTask EnableAsync(CancellationToken cancellationToken = default)
Parameters
cancellationTokenCancellationTokenA cancellation token to observe.