google-api js refactored