Dependency injection for JavaScript