Skip to content

Instantly share code, notes, and snippets.

@rustyeddy
Created February 1, 2015 19:52
Show Gist options
  • Save rustyeddy/0b279bb26c1ca9d556e8 to your computer and use it in GitHub Desktop.
Save rustyeddy/0b279bb26c1ca9d556e8 to your computer and use it in GitHub Desktop.
Success and failure handlers for Google Apps Web Apps. Place this in HTML for Google Apps HTML service.
<script>
function onSuccess(numUnread) {
alert('You have ' + numUnread + ' messages');
}
function onFailure(error) {
alert(error.message);
}
google.script.run.withSuccessHandler(onSuccess).withFailureHandler(onFailure).getUnreadEmails();
google.script.run.doSomething();
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment