Table of Contents

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

jsRuntime IJSRuntime

The 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

bool

Methods

DisableAsync(CancellationToken)

Deactivates the exit confirmation. Calling it while already inactive does nothing.

public ValueTask DisableAsync(CancellationToken cancellationToken = default)

Parameters

cancellationToken CancellationToken

A cancellation token to observe.

Returns

ValueTask

A ValueTask representing the asynchronous operation.

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

cancellationToken CancellationToken

A cancellation token to observe.

Returns

ValueTask

A ValueTask representing the asynchronous operation.