OpenMod Docs OpenMod Docs
OpenMod Docs OpenMod Docs
OpenMod .NET Plugin Framework.

Class EventBus

Inheritance
System.Object
EventBus
Implements
IEventBus
IAsyncDisposable
Namespace: OpenMod.Core.Eventing
Assembly: OpenMod.Core.dll
Syntax
public class EventBus : object, IEventBus, IAsyncDisposable

Constructors

| Improve this Doc View Source

EventBus(ILogger<EventBus>)

Declaration
public EventBus(ILogger<EventBus> logger)
Parameters
Type Name Description
ILogger<EventBus> logger

Methods

| Improve this Doc View Source

DisposeAsync()

Declaration
public virtual ValueTask DisposeAsync()
Returns
Type Description
ValueTask
| Improve this Doc View Source

EmitAsync(IOpenModComponent, Nullable<Object>, IEvent, EventExecutedCallback)

Declaration
public virtual Task EmitAsync(IOpenModComponent component, object? sender, IEvent event, EventExecutedCallback callback = null)
Parameters
Type Name Description
IOpenModComponent component
System.Nullable<System.Object> sender
IEvent event
EventExecutedCallback callback
Returns
Type Description
Task
| Improve this Doc View Source

GetEventListenerAttribute(MethodInfo)

Declaration
protected virtual EventListenerAttribute GetEventListenerAttribute(MethodInfo method)
Parameters
Type Name Description
MethodInfo method
Returns
Type Description
EventListenerAttribute
| Improve this Doc View Source

Subscribe(IOpenModComponent, Assembly)

Declaration
public virtual IDisposable Subscribe(IOpenModComponent component, Assembly assembly)
Parameters
Type Name Description
IOpenModComponent component
Assembly assembly
Returns
Type Description
IDisposable
| Improve this Doc View Source

Subscribe(IOpenModComponent, String, EventCallback)

Declaration
public virtual IDisposable Subscribe(IOpenModComponent component, string eventName, EventCallback callback)
Parameters
Type Name Description
IOpenModComponent component
System.String eventName
EventCallback callback
Returns
Type Description
IDisposable
| Improve this Doc View Source

Subscribe(IOpenModComponent, String, EventCallback, IEventListenerOptions)

Declaration
public virtual IDisposable Subscribe(IOpenModComponent component, string eventName, EventCallback callback, IEventListenerOptions options)
Parameters
Type Name Description
IOpenModComponent component
System.String eventName
EventCallback callback
IEventListenerOptions options
Returns
Type Description
IDisposable
| Improve this Doc View Source

Subscribe(IOpenModComponent, Type, EventCallback)

Declaration
public virtual IDisposable Subscribe(IOpenModComponent component, Type eventType, EventCallback callback)
Parameters
Type Name Description
IOpenModComponent component
Type eventType
EventCallback callback
Returns
Type Description
IDisposable
| Improve this Doc View Source

Subscribe(IOpenModComponent, Type, EventCallback, IEventListenerOptions)

Declaration
public virtual IDisposable Subscribe(IOpenModComponent component, Type eventType, EventCallback callback, IEventListenerOptions options)
Parameters
Type Name Description
IOpenModComponent component
Type eventType
EventCallback callback
IEventListenerOptions options
Returns
Type Description
IDisposable
| Improve this Doc View Source

Subscribe<TEvent>(IOpenModComponent, EventCallback<TEvent>)

Declaration
public virtual IDisposable Subscribe<TEvent>(IOpenModComponent component, EventCallback<TEvent> callback)
    where TEvent : IEvent
Parameters
Type Name Description
IOpenModComponent component
EventCallback<TEvent> callback
Returns
Type Description
IDisposable
Type Parameters
Name Description
TEvent
| Improve this Doc View Source

Subscribe<TEvent>(IOpenModComponent, EventCallback<TEvent>, IEventListenerOptions)

Declaration
public virtual IDisposable Subscribe<TEvent>(IOpenModComponent component, EventCallback<TEvent> callback, IEventListenerOptions options)
    where TEvent : IEvent
Parameters
Type Name Description
IOpenModComponent component
EventCallback<TEvent> callback
IEventListenerOptions options
Returns
Type Description
IDisposable
Type Parameters
Name Description
TEvent
| Improve this Doc View Source

Unsubscribe(IOpenModComponent)

Declaration
public virtual void Unsubscribe(IOpenModComponent component)
Parameters
Type Name Description
IOpenModComponent component
| Improve this Doc View Source

Unsubscribe(IOpenModComponent, String)

Declaration
public virtual void Unsubscribe(IOpenModComponent component, string eventName)
Parameters
Type Name Description
IOpenModComponent component
System.String eventName
| Improve this Doc View Source

Unsubscribe(IOpenModComponent, Type)

Declaration
public virtual void Unsubscribe(IOpenModComponent component, Type eventType)
Parameters
Type Name Description
IOpenModComponent component
Type eventType
| Improve this Doc View Source

Unsubscribe<TEvent>(IOpenModComponent)

Declaration
public virtual void Unsubscribe<TEvent>(IOpenModComponent component)
    where TEvent : IEvent
Parameters
Type Name Description
IOpenModComponent component
Type Parameters
Name Description
TEvent

Implements

IEventBus
IAsyncDisposable

Extension Methods

DisposeHelper.DisposeSyncOrAsync(Object)