I like to write anonymous event handlers on occasion and my work app is all Inversion of Control - so we have a master event bus etc. We just use hooks to add the events and then it's fine as it is properly removed.
We mostly use our master event bus which has a special hook, but the generic one looks like this:
I like to write anonymous event handlers on occasion and my work app is all Inversion of Control - so we have a master event bus etc. We just use hooks to add the events and then it's fine as it is properly removed.
We mostly use our master event bus which has a special hook, but the generic one looks like this:
Used like this: