hfour / h4bff

H4's backend & frontend framework :cupid::wrench: https://hfour.github.io/h4bff/
MIT License
7 stars 2 forks source link

Added ability to clear service and singleton overrides #26

Closed wh4everest closed 5 years ago

wh4everest commented 5 years ago

When testing or in scripts, you sometimes want to temporarily set an override which needs to be later removed. Without a clearing function, you need to instantiate a new app that doesn't have the overrides, or resort to hacks, like replacing / re-instantiating the Locator.

This PR adds two methods: app.clearSingletonOverrides and ctx.clearServiceOverrides which call Locator#clearOverrides in the corresponding Locator.

spion commented 5 years ago

how about singular version, clearOverride(Svc) - has there been any need for it?

wh4everest commented 5 years ago

@spion not that I know of. But I can add it -- it's not unreasonable to want to do that. Should I?

spion-h4 commented 5 years ago

Maybe later when we need it.