Table of Contents

Interface IEventListener

Namespace
MudBlazor
Assembly
MudBlazor.dll
public interface IEventListener : IAsyncDisposable
Inherited Members
Extension Methods

Methods

SubscribeGlobal<T>(string, int, Func<object, Task>)

Listing to a javascript event on the document itself

Task<Guid> SubscribeGlobal<T>(string eventName, int throotleInterval, Func<object, Task> callback)

Parameters

eventName string

Name of the DOM event without "on"

throotleInterval int

The delay between the last time the event occurred and the callback is fired. Set to zero, if no delay is requested

callback Func<object, Task>

The method that is invoked, if the DOM element is fired. Object will be of type T

Returns

Task<Guid>

A unique identifier for the event subscription. Should be used to cancel the subscription

Type Parameters

T

The type of the event args for instance MouseEventArgs for mousemove

Subscribe<T>(string, string, string, int, Func<object, Task>)

Listing to a javascript event

Task<Guid> Subscribe<T>(string eventName, string elementId, string projectionName, int throotleInterval, Func<object, Task> callback)

Parameters

eventName string

Name of the DOM event without "on"

elementId string

The value of the id field of the DOM element

projectionName string

The name of a JS function (relative to window) that used to project the event before it is send back to .NET. Can be null, if no projection is needed

throotleInterval int

The delay between the last time the event occurred and the callback is fired. Set to zero, if no delay is requested

callback Func<object, Task>

The method that is invoked, if the DOM element is fired. Object will be of type T

Returns

Task<Guid>

A unique identifier for the event subscription. Should be used to cancel the subscription

Type Parameters

T

The type of the event args for instance MouseEventArgs for mousemove

Unsubscribe(Guid)

Cancel (unsubscribe) the listening to a DOM event, previous connected by Subscribe

Task<bool> Unsubscribe(Guid key)

Parameters

key Guid

The unique event identifier

Returns

Task<bool>

true for if the event listener was detached, false if not