init
This commit is contained in:
31
docs/ai/Common/DTS.Common.Core/EventManager.md
Normal file
31
docs/ai/Common/DTS.Common.Core/EventManager.md
Normal file
@@ -0,0 +1,31 @@
|
||||
---
|
||||
source_files:
|
||||
- Common/DTS.Common.Core/EventManager/EventManager.cs
|
||||
generated_at: "2026-04-17T16:08:08.426285+00:00"
|
||||
model: "zai-org/GLM-5-FP8"
|
||||
schema_version: 1
|
||||
sha256: "1537aca27bc7a4d4"
|
||||
---
|
||||
|
||||
# EventManager
|
||||
|
||||
### Purpose
|
||||
Implements a lightweight, in-process publish/subscribe event system that allows components to communicate without direct coupling. Publishers emit events by type, and subscribers register callbacks to receive specific event types, optionally with filtering predicates. The module also supports diagnostic listeners for monitoring event system activity.
|
||||
|
||||
### Public Interface
|
||||
|
||||
**`SubscriberCallbackDelegate<in T>` (delegate)**
|
||||
- `void SubscriberCallbackDelegate<in T>(T item) where T : class` — Delegate signature for event listeners.
|
||||
|
||||
**`DiagnosticCallbackDelegate` (delegate)**
|
||||
- `void DiagnosticCallbackDelegate(EventDiagnosticType eventType, Type t, object eventData, string listener)` — Delegate signature for diagnostic event listeners.
|
||||
|
||||
**`EventManager` (static class)**
|
||||
|
||||
- `static void Publish<T>(T eventData) where T : class` — Publishes an event to all subscribers of type `T`. If no subscribers exist for the type, returns immediately. For each subscriber, evaluates the `EventFilter` predicate (if present) before invoking the callback.
|
||||
|
||||
- `static void Subscribe<T>(SubscriberCallbackDelegate<T> listener) where T : class` — Subscribes a callback to events of type `T` without filtering.
|
||||
|
||||
- `static void Subscribe<T>(SubscriberCallbackDelegate<T> listener, Predicate<T> eventFilter) where T : class` — Subscribes a callback to events of type `T` with an optional filter predicate. If the filter returns `false` for a given event, the callback is not invoked.
|
||||
|
||||
- `static void UnSubscribe<T>(SubscriberCallbackDelegate<T> listener) where T : class` — Removes a subscriber callback from the subscriber
|
||||
Reference in New Issue
Block a user