简体   繁体   中英

Angular 6: what is the Reflect API in polyfills.ts?

In polyfills.ts , one of the commented out lines reads as follows:

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

What is the 'Reflect API'? What IE use cases is it needed for and is this import statement typically important when running an Angular application in IE ? Surprisingly, Google and StackOverflow didn't turn up many/any results for me.

The ES6 Reflect API gives you a Reflect object that lets you call methods, construct objects, getting and setting prototypes, manipulating and extending properties. Reflect is a built-in object that provides methods for interceptable JavaScript operations. The methods are the same as those of proxy handlers. More details, please check the Reflect and the ES6 Reflect API Tutorial

From the Browser compatibilitySection , we can see IE not support Reflect, by using the Polyfills, it makes us using Reflect in IE browser.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM