Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there any way to use this library on an env where Proxy is not available? #45

Closed
danechitoaie opened this issue Jul 20, 2018 · 12 comments · Fixed by #184
Closed

Is there any way to use this library on an env where Proxy is not available? #45

danechitoaie opened this issue Jul 20, 2018 · 12 comments · Fixed by #184

Comments

@danechitoaie
Copy link

No description provided.

@imbrn
Copy link
Owner

imbrn commented Jul 20, 2018

Thank you @danechitoaie for your feedback.

At the moment, I chose not to polyfill Proxy because all major browsers already have support for that. But we should have some documentation explaining better how to polyfill that anyway.

But for now, you can go to this link (https://github.com/GoogleChrome/proxy-polyfill). It'll show you how you can polyfill Proxy in your application.

Please let me know if you have any questions.

@danechitoaie
Copy link
Author

I want to use this on SFCC (former Demandware) and they run JS in Rhino which kind of supports an ancient version of JS. I'll try with the polyfill to see if it works.

Thanks.

@imbrn imbrn closed this as completed Jul 21, 2018
@iangilman
Copy link

I guess it depends upon how you define major browsers. IE 11 doesn't support Proxy:

https://caniuse.com/#search=proxy

… and its browser share of 2.66% is significantly greater than any version of Edge, and right up there with Firefox and Safari:

https://caniuse.com/#search=proxy

… so I'd call IE 11 a major browser, unless Chrome is the only one that makes the cut.

@bassarisse
Copy link

bassarisse commented Nov 7, 2018

Hi there!

We love v8n in the company I work for, but here, supporting older environments is a requirement, unfortunately. I tested the Google polyfill but got no success with it, so I managed to make the lib work without Proxies, with a relatively small (and somewhat ugly) modification.

Here's the commit:
bassarisse@ff123c5

Do you guys think it would be a good PR? Is this something you'd like to support?

PS: I forced the tests to run without Proxy, and all of them passed. I guess we'd just have to figure out a way to run the same conditions, with and without Proxy (sorry, I'm not well versed in this area).

@iangilman
Copy link

Sounds great to me! I too have a website that needs to support IE11.

@SnirShechter
Copy link

Any progress on this?

@NoemiRozpara
Copy link

Hi! I found out this is still an issue, so picked @bassarisse 's commit into the most recent version of the library and opened a PR. This is not a breaking change and a true life-savior, so I'd be more than happy to see it merged.

Unfortunately proxy in this case can't be polyfilled - was getting an error can't get property "empty" on null or undefined in the following use case:

const { bindValidation, getFieldError } = useFormValidation({
    validations: {
      email: v8n().not.empty()
    },
    onSubmit: fields => {
      if (onDone) onDone(fields.email);
    }
  });

@bassarisse 's solution was tested in IE11 / Win 10. #171

@sbarfurth
Copy link
Collaborator

Thanks @NoemiRozpara for your pull request. It looks like it's working fine.

I'm just not quite happy with the code yet, but I think the idea is good. It adds more of a "works out of the box" feel if you never need to run an external polyfill.

@sbarfurth
Copy link
Collaborator

The PR we had for this has been closed. I might be able to take a look at this at some point. If not, @ev-akarel might be able to submit a PR that works.

@ev-akarel
Copy link

@brfrth I'll try and get to it this week. It'd be nice to not need the local fork I have.

@akarel akarel mentioned this issue Mar 3, 2021
9 tasks
@ev-akarel
Copy link

@brfrth Any chance you could review #184 ?

@sbarfurth
Copy link
Collaborator

@ev-akarel Sorry, I reviewed it. It looks fine :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants