Table of Contents

Class JsEvent

Namespace
MudBlazor.Services
Assembly
MudBlazor.dll

Subscribe JS events of any element by html id

public class JsEvent : IJsEvent, IDisposable
Inheritance
JsEvent
Implements
Inherited Members
Extension Methods

Constructors

JsEvent(IJSRuntime)

public JsEvent(IJSRuntime jsRuntime)

Parameters

jsRuntime IJSRuntime

Methods

Connect(string, JsEventOptions)

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

public Task Connect(string elementId, JsEventOptions options)

Parameters

elementId string

Ancestor html element id

options JsEventOptions

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

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

OnCaretPositionChanged(int)

To be invoked only by JS

[JSInvokable]
public void OnCaretPositionChanged(int caretPosition)

Parameters

caretPosition int

OnPaste(string)

To be invoked only by JS

[JSInvokable]
public void OnPaste(string text)

Parameters

text string

OnSelect(int, int)

To be invoked only by JS

[JSInvokable]
public void OnSelect(int start, int end)

Parameters

start int
end int

Events

CaretPositionChanged

Subscribe this event to get notified about caret changes in an input on click and on keyup

public event Action<int> CaretPositionChanged

Event Type

Action<int>

Paste

Subscribe this event to get notified about paste actions

public event Action<string> Paste

Event Type

Action<string>

Select

Subscribe this event to get notified about paste actions

public event Action<int, int> Select

Event Type

Action<int, int>