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
除非適用法律要求或以書面形式同意,否則根據許可證分配的軟件是按照“原樣”分發的,沒有任何明示或暗示的任何形式的保證或條件。請參閱許可證,以獲取執行許可條款和限制的特定語言。