spinettaro / delphi-event-bus

Delphi Event Bus (for short DEB) is an Event Bus framework for Delphi
Apache License 2.0
466 stars 110 forks source link

Enhance to allow specify Context during runtime. If a subscriber method has its SuscriberAttribute.Context unspecified, then the instance-specific context specified when calling IEventBus.RegisterSubscriberForEvents will be set as the context for that... #57

Closed wxinix closed 3 years ago

wxinix commented 3 years ago

... method. This allows a method's context to be dynamically set during runtime.This is with regard Issue #54.

dkounal commented 3 years ago

It is more than OK for me. Thank you for your time and the discussion I also forgot that for interfaces we can have default values.

wxinix commented 3 years ago

@dkounal thank you - I had thought this is going to be a complex change but I borrowed your code (especially the idea TSubscriberMethod.SetContext to inject new context) . Thank you for the initial thought of "runtime" context, which I agree is a good new feature.

I added a new test case for tinstance context. I am going to close this PR, and create a new PR with new test case.