Class GameEvent<TArgs>
- Namespace
- SkyrimForge.Events
- Assembly
- SkyrimForge.dll
An IGameEvent<TArgs> with a Raise(TArgs) method for the code that raises the event.
public sealed class GameEvent<TArgs> : IGameEvent<TArgs> where TArgs : struct
Type Parameters
TArgs
- Inheritance
-
GameEvent<TArgs>
- Implements
-
IGameEvent<TArgs>
- Inherited Members
- Extension Methods
Constructors
GameEvent(Action<Exception>)
Creates an event with no subscribers.
public GameEvent(Action<Exception> reportFailure)
Parameters
reportFailureAction<Exception>Receives the exception from a subscriber that threw. That subscriber is dropped first, so it is reported once.
Exceptions
- ArgumentNullException
reportFailureisnull.
Methods
Raise(TArgs)
Invokes every current subscriber. A subscriber that throws is removed and reported, and the subscribers after it still run.
public void Raise(TArgs args)
Parameters
argsTArgs
Subscribe(AsyncGameEventHandler<TArgs>)
Registers handler, whose task the event does not await.
public ISubscription Subscribe(AsyncGameEventHandler<TArgs> handler)
Parameters
handlerAsyncGameEventHandler<TArgs>
Returns
Remarks
A later raise can call the handler again while an earlier task is pending. A handler that throws, or whose task faults, is dropped and not called again, even after a later load. The exception is written to its plugin's log. A canceled task does not drop the handler.
Exceptions
- ArgumentNullException
handlerisnull.
Subscribe(GameEventHandler<TArgs>)
Registers handler.
public ISubscription Subscribe(GameEventHandler<TArgs> handler)
Parameters
handlerGameEventHandler<TArgs>
Returns
Remarks
A handler that throws is dropped and not called again, even after a later load. The exception is written to its plugin's log.
Exceptions
- ArgumentNullException
handlerisnull.