Created
January 11, 2014 18:59
-
-
Save goyuninfo/8375208 to your computer and use it in GitHub Desktop.
Google App script Script-as-app template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Script-as-app template. | |
function doGet() { | |
var app = UiApp.createApplication(); | |
var button = app.createButton('Click Me'); | |
app.add(button); | |
var label = app.createLabel('The button was clicked.') | |
.setId('statusLabel') | |
.setVisible(false); | |
app.add(label); | |
var handler = app.createServerHandler('myClickHandler'); | |
handler.addCallbackElement(label); | |
button.addClickHandler(handler); | |
return app; | |
} | |
function myClickHandler(e) { | |
var app = UiApp.getActiveApplication(); | |
var label = app.getElementById('statusLabel'); | |
label.setVisible(true); | |
app.close(); | |
return app; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment