Skip to content

Instantly share code, notes, and snippets.

@ithinkihaveacat
Created May 15, 2016 14:34
Show Gist options
  • Select an option

  • Save ithinkihaveacat/97b0fe3bc2e3733f0c06aa91c7021d77 to your computer and use it in GitHub Desktop.

Select an option

Save ithinkihaveacat/97b0fe3bc2e3733f0c06aa91c7021d77 to your computer and use it in GitHub Desktop.
function gapiLoad(s) {
return new Promise(r => {
gapi.load(s, () => r(gapi[s]));
});
}
function getClient(s, v) {
if (!v) v = 'v1';
return gapiLoad('client').then(client => {
client.load(s, v).then(function() {
return gapi.client[s];
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment