Dependency injection for javascript