Promises and async class constructors in Apps Script

44 views
Skip to first unread message

Bruce Mcpherson

unread,
Jun 16, 2024, 11:55:38 AM (10 days ago) Jun 16
to Google Apps Script Community

Apps Script doesn’t do asynchronous – so what’s this all about?

Since the move to v8, Apps Script supports the Promises as well as the related async/await syntax. Normally we don’t have to worry about all that since all Apps Script services are synchronous. Yet we do know that server side, plenty of asynchronous things are happening. So there is clearly a mechanism for making asynchronous things synchronous.

In an imminent article I’ll be covering my port of the excellent pdf-lib library to Apps Script. Before I get to that I wanted to do a bit of background on handling Promises in Apps Script. The methods in these kind of Node ports to Apps Script libraies often return Promises. In Apps Script you’ll have to deal with the complication of async without getting the benefits. This article is to provide some background for the use of such libraries.


article
https://ramblings.mcpher.com/gassnippets2/promises-and-async-class-constructors-in-apps-script/
Reply all
Reply to author
Forward
0 new messages