Dependency Injection in Javascript