角度6:polyfills.ts中的Reflect API是什么?

时间:2018-10-31 20:35:39

标签: angular typescript internet-explorer cross-browser polyfills

polyfills.ts中,注释掉的一行之一如下:

/** IE10 and IE11 requires the following for the Reflect API. */
// import 'core-js/es6/reflect';

什么是“反映API”?它需要什么IE用例?在Angular中运行IE应用程序时,此import语句通常很重要吗?令人惊讶的是,Google和StackOverflow并没有为我带来很多/任何结果。

1 个答案:

答案 0 :(得分:5)

ES6 Reflect API为您提供了一个Reflect对象,使您可以调用方法,构造对象,获取和设置原型,操纵和扩展属性。 Reflect是一个内置对象,它提供可拦截JavaScript操作的方法。这些方法与代理处理程序的方法相同。详细信息,请检查ReflectES6 Reflect API Tutorial

Browser compatibilitySection中,我们看到IE不支持Reflect,通过使用Polyfills,它使我们在IE浏览器中使用Reflect。