public class EventDispatcher<T = Event>:
Multicast dispatcher generated behind event declarations.
Application code normally declares public event clicked as ActionEvent and uses +=, -= and emit this.clicked(...). This class remains public so the compiler can materialize concrete generic dispatchers and advanced code can inspect the registered handler count when needed.
dispatcher = EventDispatcher<Event>() dispatcher += lambda(e: Event): print(e.source)
| Modifier and Type | Member | Description |
|---|---|---|
| public readonly property | sizesize as ULong: |
Number of registered handlers. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | EventDispatcher | Creates an empty event dispatcher. |
| Modifier and Type | Member | Description |
|---|---|---|
| public | connectconnect(handler as Object) as EventDispatcher<T>: |
Registers a handler. |
| public | disconnectdisconnect(handler as Object) as EventDispatcher<T>: |
Unregisters a handler. |
| public | dispatchdispatch(payload as T) as Void: |
Emits a pre-built event payload. |