Cleaner Javascript Dependency Injection Implementation