Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ES6 Proxy Polyfill for IE11

IE11 does not and will not implement ES2015 Proxy objects. Yet IE11's end of extended support is October 14, 2025.

Is there any way to polyfill Proxy objects for IE11? All other browsers support Proxy already.

If yes then we would all be able to use it in production today. If not then we'll have to wait almost a decade...

Edit: I'm asking specifically for IE11 as I know IE to usually have IE specific features that I'm often not aware of.

Edit2: I'm particularly interested in being able to implement a catch-all interceptor. Similar to __getattr__ in Python. It only has to work in IE11.

like image 428
brillout Avatar asked Jul 24 '17 16:07

brillout


2 Answers

There's quite a concise answer for this question on Quora

Proxies require support on the engine level and it is not possible to polyfill Proxy.

Most major JS engines have yet to implement support. Check out the ECMAScript 6 compatibility table.

You may want to use Object.observe instead, possibly with polyfills for browsers other than Chrome, but even then the proposal has been withdrawn, and it has been announced it will be removed from Chrome in a future version.

I personally haven't tried the Object.observe solution but it might be a good place to start.

Good luck!

EDIT: Thank you to Matt Jensen in the comments for pointing out there is infact a way to polyfill some parts of ES6 Proxy using this package: github.com/GoogleChrome/proxy-polyfill

AWESOME

like image 33
George Avatar answered Oct 07 '22 17:10

George


Best you can get is github: GoogleChrome/proxy-polyfill

According to Babel docs:

Due to the limitations of ES5, Proxies cannot be transpiled or polyfilled.

like image 102
Dolf Barr Avatar answered Oct 07 '22 17:10

Dolf Barr