Table of Contents

Class KeyInterceptor

Namespace
MudBlazor.Services
Assembly
MudBlazor.dll

This transient service binds itself to a parent element to observe the keys of one of its children. It can call preventDefault or stopPropagation directly on the JavaScript side for single key strokes / key combinations as per configuration. Furthermore, you can precisely subscribe single keystrokes or combinations and only the subscribed ones will be forwarded into .NET

public class KeyInterceptor : IKeyInterceptor, IDisposable
Inheritance
KeyInterceptor
Implements
Inherited Members
Extension Methods

Constructors

KeyInterceptor(IJSRuntime)

public KeyInterceptor(IJSRuntime jsRuntime)

Parameters

jsRuntime IJSRuntime

Methods

Connect(string, KeyInterceptorOptions)

Connect to the ancestor element of the element(s) that should be observed

public Task Connect(string elementId, KeyInterceptorOptions options)

Parameters

elementId string

Ancestor html element id

options KeyInterceptorOptions

Define here the descendant(s) by setting TargetClass and the keystrokes to be monitored / suppressed

Returns

Task

Disconnect()

Disconnect from the previously connected ancestor and its descendants

public Task Disconnect()

Returns

Task

Dispose()

public void Dispose()

Dispose(bool)

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

OnKeyDown(KeyboardEventArgs)

[JSInvokable]
public void OnKeyDown(KeyboardEventArgs args)

Parameters

args KeyboardEventArgs

OnKeyUp(KeyboardEventArgs)

[JSInvokable]
public void OnKeyUp(KeyboardEventArgs args)

Parameters

args KeyboardEventArgs

UpdateKey(KeyOptions)

Update behavior of a registered keyoption The keystrike to update has to be monitored previously

public Task UpdateKey(KeyOptions option)

Parameters

option KeyOptions

Define KeyOption to update

Returns

Task

Events

KeyDown

public event KeyboardEvent KeyDown

Event Type

KeyboardEvent

KeyUp

public event KeyboardEvent KeyUp

Event Type

KeyboardEvent