File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -4,5 +4,5 @@ function doGet() {
44
55function getUnreadEmails ( ) {
66 // 'got' instead of 'get' will throw an error.
7- return GmailApp . gotInboxUnreadCount ( ) ;
8- }
7+ return GmailApp . getInboxUnreadCount ( ) ;
8+ }
Original file line number Diff line number Diff line change @@ -7,7 +7,12 @@ function getBankBalance() {
77 return deepSecret_ ( email ) ;
88}
99
10+ /**
11+ * @param {string } email The user's email address.
12+ * @return {string } A string with the user's balance.
13+ * @private
14+ */
1015function deepSecret_ ( email ) {
11- // Do some secret calculations
12- return email + ' has $1,000,000 in the bank.' ;
13- }
16+ // Do some secret calculations
17+ return email + ' has $1,000,000 in the bank.' ;
18+ }
Original file line number Diff line number Diff line change 1+ /* eslint-disable no-unused-vars */
2+
3+ /**
4+ * @typedef {Object } GoogleScriptRun
5+ * @property {function():void } doSomething
6+ * @property {function():void } doSomethingElse
7+ * @property {function(function(string):void):GoogleScriptRun } withSuccessHandler
8+ * @property {function(function(Error):void):GoogleScriptRun } withFailureHandler
9+ */
10+
11+ /**
12+ * @type {{script: {run: GoogleScriptRun}} }
13+ */
14+ var google = {
15+ script : {
16+ run : {
17+ doSomething : function ( ) { } ,
18+ doSomethingElse : function ( ) { } ,
19+ withSuccessHandler : function ( ) {
20+ return this ;
21+ } ,
22+ withFailureHandler : function ( ) {
23+ return this ;
24+ } ,
25+ } ,
26+ } ,
27+ } ;
28+
29+ /**
30+ * @param {Error } error
31+ */
32+ function onFailure ( error ) {
33+ console . log ( error . message ) ;
34+ }
35+
36+ /**
37+ * @param {string } result
38+ */
39+ function onSuccess ( result ) {
40+ console . log ( result ) ;
41+ }
42+
43+ /**
44+ * @param {string } result
45+ */
46+ function onDifferentSuccess ( result ) {
47+ console . log ( result ) ;
48+ }
49+
150var myRunner = google . script . run . withFailureHandler ( onFailure ) ;
251var myRunner1 = myRunner . withSuccessHandler ( onSuccess ) ;
352var myRunner2 = myRunner . withSuccessHandler ( onDifferentSuccess ) ;
Original file line number Diff line number Diff line change @@ -2,6 +2,16 @@ function doGet() {
22 return HtmlService . createHtmlOutputFromFile ( 'Index' ) ;
33}
44
5+ /**
6+ * @typedef {{myFile: any} } FormObject
7+ */
8+
9+ /**
10+ * Processes a form submission with a file upload.
11+ *
12+ * @param {FormObject } formObject The form object submitted by the user.
13+ * @return {string } The URL of the uploaded file.
14+ */
515function processForm ( formObject ) {
616 var formBlob = formObject . myFile ;
717 var driveFile = DriveApp . createFile ( formBlob ) ;
You can’t perform that action at this time.
0 commit comments