This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Polymer({ | |
is: 'x-foo', | |
ready() { | |
// provides a FooService to descendents | |
this.provideInstance('foo-service', new FooService()); | |
}, | |
attached() { | |
// requests a BarService from an ancestor, re-requests if moved |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Dependency injection can help you reduce coupling and increase testability, making your applications more maintainable. | |
* | |
* DependencyResolver gives you the best of both worlds by mixing a registry with call time dependency resolution. In addition, it provides significant resource | |
* usage advantages over other patterns, such as an object pool, because dependencies are only resolved when they are actually needed. | |
* | |
* It supports both constructor injection for class wide dependencies, as well as method injection for method specific dependencies. | |
* |