1

I am trying to use ES6 Proxies in an Angular app of mine as so:

// Create defensive object using ES6 Proxy
createDefensiveObject(target) {

  return new Proxy(target, {

    get : (target, property) => {

      if(property in target) 
        return target[property];

      else
        throw new ReferenceError(`Property \"${property}\" does not exist`);
    }
  });
}

I am using Traceur to transpile everything in Chrome, and I have experimental JavaScript enabled. All other ES6 features I have implemented are working as expected, but with Proxies I get : Reference Error: Proxy is not defined

Any insight?

1 Answer 1

2

Referencing this table here it would seem that Traceur has no support for ES6 proxies at this time. Babel which I use to transpile back-end code also has no support. It looks as though io.js has limited support, so further research will have to be done in order to determine whether that solution will be suitable to our needs. Though this won't help my Angular front-end.

Sign up to request clarification or add additional context in comments.

3 Comments

Proxy is one of the ES6 features that cannot be polyfilled unfortunately.
I managed to find a polyfill called harmony-reflect, but Chrome has zero Proxy support outside of enabling some Chromium flags from what I understand. Which makes it useless for my case.
Yeah that only makes old proxies follow the spec, it doesn't add support for Proxy where there is none unfortunately.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.