Dependency injection for Javascript