IronBlock
IronBlock copied to clipboard
Before/AfterBlock hooks
In order to visualise/log the running script it would be handy to have before/after hooks .
- Add Before After hooks to Block model (those will apply to specific block)
- Add Before After hooks to Context model (those will apply to every block)
- Before/After method should have access to Context
Hook Implementation:
-
Option one: use nullable Func variables or delegates reference in models, easy to check for null and execute if not null
-
Option two: Use EventHandlers and delegates
- Should be fastest method? widely used for time sensitive events lime mouse interaction
- build in handling of empty handler
-
Option three: Add Before/After abstract method to base block and context models, let implementation override it.
- waste of resources if hooks are not used as the abstract method would always be called
- Possible to use interfaces IBeforeAction, IAfterAction, implemented interfaces can be detected, still I imagine simple null check is faster.