Google Apps Script V8引擎是否支持Promise? [英] Does Google Apps Script V8 engine support Promise?

查看:94
本文介绍了Google Apps Script V8引擎是否支持Promise?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

他们说V8引擎是正确的Javascript ES5引擎.它是否支持诸如Promise之类的ES5功能?

They say V8 engine is a proper Javascript ES5 engine. Does it support ES5 features like Promise?

推荐答案

App脚本V8可以识别新的函数定义格式,例如:

Apps script V8 recognizes the new function definition formats, for example:

let letAsyncFunction = async function() { //Your logic here }

它异步地返回函数求值的结果,就像一个Promise.

It asynchronously returns the result of the function evaluations, pretty much like a Promise.

换句话说,当调用函数async时,它将返回一个Promise.此外,await用于调用异步函数并等待其解析或拒绝

In other words, when the function async is called, it returns a promise. Also await is used for calling an async function and wait for it to resolve or reject

参考文献:

  • async function
  • V8 runtime Overview

这篇关于Google Apps Script V8引擎是否支持Promise?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆