dependency injection for browser based javascript