From http://krasimirtsonev.com/blog/article/Dependency-injection-in-JavaScript