I need to create an service that different parts of the system can register handlers with, but I'm unsure of the approved model to do this.
I could probably create a global variable somewhere and then have my components register against that, but it feels a bit hacky.
Something along the lines of:
Module A creates an Object with an array of handlers
Module B registers 3 handlers with the object from Module A
Module A does some processing based on the handlers registered by Module B
How is this best done? Perhaps adding something to metadata or something?
Or perhaps binding? (careful explaining if this is the direction as I've read the docs and barely understand it!!)
Thanks
I could probably create a global variable somewhere and then have my components register against that, but it feels a bit hacky.
Something along the lines of:
Module A creates an Object with an array of handlers
Module B registers 3 handlers with the object from Module A
Module A does some processing based on the handlers registered by Module B
How is this best done? Perhaps adding something to metadata or something?
Or perhaps binding? (careful explaining if this is the direction as I've read the docs and barely understand it!!)
Thanks
Comment