samber / do

⚙️ A dependency injection toolkit based on Go 1.18+ Generics.
https://pkg.go.dev/github.com/samber/do
MIT License
1.82k stars 75 forks source link

Add hook at the scope level #72

Open samber opened 5 months ago

samber commented 5 months ago

AfterRegistration and AfterShutdown are currently defined globally.

It would be nice to listen events at the scope level.

In a big project, having tons of libs and modules, a developer should be able to create listeners locally, in its own scope.

Question: do we need to listen to events coming from the current scope or events coming from children as well?