Javascript dependency injection system