delphi event bus
vent Bus 2.1

Delphi Event Bus(用于简短DEB)是Delphi平台的出版/订阅事件总线框架。
DEB旨在将应用程序的不同零件/层解次,同时仍允许它们有效交流。它的灵感来自Android平台的EventBus框架。

请在Github“星”这个项目!它无需花费,但有助于参考代码

1.定义事件:
IEvent = interface (IInterface)
[ ' {3522E1C5-547F-4AB6-A799-5B3D3574D2FA} ' ]
// additional information here
end ;2. Prepare用户:
[Subscribe]
procedure OnEvent (AEvent: IAnyTypeOfEvent);
begin
// manage the event
end ;GlobalEventBus.RegisterSubscriberForEvents(Self);3.事件:
GlobalEventBus.post(LEvent);1.定义频道:
const MY_CHANNEL = ' MYCHANNEL '2. Prepare用户:
[Channel(MY_CHANNEL)]
procedure OnMessage (AMsg: string);
begin
// manage the message
end ;GlobalEventBus.RegisterSubscriberForChannels(Self);3.频道上的事件:
GlobalEventBus.post(MY_CHANNEL, ' My Message ' );版权2016-2022 Daniele Spinetti
根据Apache许可证(版本2.0(“许可”)获得许可;除了符合许可外,您不得使用此文件。您可以在
http://www.apache.org/licenses/license-2.0
除非适用法律要求或以书面形式同意,否则根据许可证分配的软件是按照“原样”分发的,没有任何明示或暗示的任何形式的保证或条件。请参阅许可证,以获取执行许可条款和限制的特定语言。