-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtablist-js.html
46 lines (40 loc) · 1.24 KB
/
tablist-js.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<script>
<!-- when page loads run the iniitalization code -->
if( document.readyState !== 'loading' ) {
console.log( 'document is already ready, just execute code here' );
myInitCode();
} else {
document.addEventListener('DOMContentLoaded', function () {
console.log( 'document was not ready, place code here' );
myInitCode();
});
}
function myInitCode() {
document.getElementById("btn-close").addEventListener("click",closeIt);
document.getElementById("btn-message").addEventListener("click",aMessage);
document.getElementById("btn-authorize").addEventListener("click",getSum);
}
//'pick' is a "factory" send the function that you want to run with the args in an array...
function aMessage(){
google.script.run
.withSuccessHandler(onSuccess)
.withFailureHandler(showError)
.pick('callLibrary');
}
function getSum(){
google.script.run
.withSuccessHandler(onSuccess)
.withFailureHandler(showError)
.pick('test',[45,55]);
}
function onSuccess(theText){
document.getElementById('result').innerHTML = theText;
}
function showError(err){
console.log(err);
document.getElementById('result').innerHTML = "The error is " + err;
}
function closeIt(){
google.script.host.close();
}
</script>