Pattern for decorating a provider?
Opened this issue · 1 comments
buchanae commented
class Service {}
@Provide(Service)
@Inject(Service)
function decorateService(service) {
// decoration happens here
// e.g. service.someFunc = function() { log('someFunc called'); };
return service;
}
Currently this is a circular dependency error.
Is this something you think should be possible in di.js?
vojtajina commented
Yeah, we don't have decorators yet. I think it's a valid feature request.
Some questions to consider:
- Can you have multiple decorators for a single token?
- If so... how about the order in which they are applied?
- How about decorating "all with annotation x" (in addition to decorating particular token)?