It looks like you're new here. If you want to get involved, click one of these buttons!
I'm working on a plugin (thanks x00 for the tons of help) and I started using the Events mechanism. I saw that property EventArguments can be used to pass additional data to an event, but I also noticed something, in my opinion, odd: array EventArguments never gets cleaned up, and every event receives all the arguments eventually passed to previous ones.
$this->EventArgument['MyArgument'] = 123; $this->FireEvent('FirstEvent');
The handler for FirstEvent will see
MyArgument = 123. If, in another place, we do something like:
$this->EventArgument['MyOtherArgument'] = 'something new'; $this->FireEvent('SecondEvent');
The handler of SecondEvent will receive both
MyArgument = 123 and
MyOtherArgument= 'something new'. Of course, the second handler could simply ignore the arguments it's not expecting, but it's still quite "dirty" to have a single shared buffer for Event Arguments.
This is the first time I see this kind of behaviour, as I was used to the fact that Event Arguments live and die with the event itself; my main fear is that this mechanism it may lead to concurrency issues (but I admit I'm still a novice with Vanilla and I may be wrong).