kevind7 / delphi-event-bus

Delphi Event Bus (for short DEB) is an Event Bus framework for Delphi

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

alt text

DEB an Event Bus framework for Delphi

Delphi Event Bus (for short DEB) is a publish/subscribe Event Bus framework for the Delphi platform.

DEB is designed to decouple different parts/layers of your application while still allowing them to communicate efficiently. It was inspired by EventBus framework for the Android platform.

alt text

Features

  • Easy and clean: DelphiEventBus is super easy to learn and use because it respects KISS and "Convention over configuration" design principles. By using default TEventBus instance, you can start immediately to delivery and receive events
  • Designed to decouple different parts/layers of your application
  • Event Driven
  • Attributes based API: Simply put the Subscribe attribute on your subscriber method you are able to receive a specific event
  • Support different delivery mode: Specifying the TThreadMode in Subscribe attribute, you can choose to delivery the event in the Main Thread or in a Background ones, regardless where an event was posted. The EventBus will manage Thread synchronization
  • Unit Tested
  • Thread Safe

Show me the code

1.Define events:

TEvent = class(TObject)
// additional information here
end;

2.Prepare subscribers:

  • Declare your subscribing method:
[Subscribe]
procedure OnEvent(AEvent: TAnyTypeOfEvent);
begin
  // manage the event 	
end;
  • Register your subscriber:
TEventBus.GetDefault.RegisterSubscriber(self);

3.Post events:

  TEventBus.GetDefault.post(LEvent);

##Support

  • DEB is a 100% ObjectPascal framework so it works on VCL and Firemonkey
  • It works with Delphi2010 and major

License

Copyright 2016 Daniele Spinetti

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

About

Delphi Event Bus (for short DEB) is an Event Bus framework for Delphi

License:Apache License 2.0


Languages

Language:Pascal 100.0%