ES6 Proxy Polyfill for IE11

37,353

Solution 1

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.

Solution 2

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

Share:
37,353
brillout
Author by

brillout

https://brillout.com/

Updated on October 04, 2020

Comments

  • brillout
    brillout over 3 years

    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.

  • brillout
    brillout almost 7 years
    I'm looking for a IE11 polyfill not for a ES5 pollyfill, as stated several times in the OP. And the library you mention doesn't support catch-all getters. And again, the OP explicitly mentions interest in catch-all getters.
  • Dolf Barr
    Dolf Barr almost 7 years
    As i remember and understand right, according to babel team, it's impossible to fully implement proxy polyfill due to limitations of ES5 (which is used by ie11 as well), Proxies should be implemented on engine level. That's what i was trying to explain, when i'm talking that this lib is best what you can get. More here: comment on github in babel, similar question on quora
  • Dolf Barr
    Dolf Barr almost 7 years
  • Dolf Barr
    Dolf Barr almost 7 years
    And accroding to you question - maybe it should be "how to implement a catch-all interceptor with IE11 compatibility" rather than "ES6 Proxy Polyfill for IE11"?
  • George
    George over 6 years
    @Dolf Did you get anywhere with this?
  • Will Farley
    Will Farley about 6 years
    Accourding to the GoogleChrome/proxy-polyfill support section, this should work with ie9+
  • Gordon Leigh
    Gordon Leigh almost 6 years
    Transpilers can't help you if there is no working polyfill. The plugin you pointed to uses a combination of a transpiler and a polyfill that rewrites all property access to go via the proxy, which will be hideously slow.
  • Joe Maffei
    Joe Maffei over 5 years
    IE11 doesn't have Object.observe.
  • Matt Jensen
    Matt Jensen over 4 years
    Not entirely true. There's many parts of the Proxy API that are able to be polyfilled. Please see: github.com/GoogleChrome/proxy-polyfill