Angular 5 Polyfill是否异步/等待IE11 [英] Does Angular 5 polyfill async / await for IE11

查看:118
本文介绍了Angular 5 Polyfill是否异步/等待IE11的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们开发了需要IE11支持的软件.如多个来源所述,IE11不支持异步/等待:

We develop a software which needs to be supported by IE11. As multiple sources state, IE11 does not support async/await:

  • https://caniuse.com/#feat=async-functions
  • http://kangax.github.io/compat-table/es2016plus/

以及一些博客文章.

我们现在确实编写了一个简单的Angular 5项目,该项目使用async/await,并且在IE11中运行良好.我们可以安全地假设Angular使用某种polyfill在IE11中添加对此的支持吗?我找不到任何资料表明Angular添加了对它的支持.

We did now write a simple Angular 5 project which uses async/await and it is working fine in IE11. Can we safely assume that Angular uses some kind of polyfill to add support for this in IE11? I cannot find any source stating that Angular adds support for it.

推荐答案

从TypeScript 2.1开始,TypeScript编译器已支持

As of TypeScript 2.1, the TypeScript compiler has support for compiling async/await code down to a form that works even on IE6!

因此,如果您的tsconfig.json的目标设置为ES5或更低(在Angular CLI项目中默认为这种情况),TypeScript将为您处理此转换.可能需要polyfill才能使用的唯一功能就是Promise.

So, if your tsconfig.json has the target set to ES5 or lower (which is the case by default in Angular CLI projects), TypeScript will handle this conversion for you. The only feature you'd potentially need to polyfill to be able to make use of this would be Promise.

这篇关于Angular 5 Polyfill是否异步/等待IE11的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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