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

No private property forwarding #26

Open
ypicard opened this issue Oct 11, 2022 · 0 comments
Open

No private property forwarding #26

ypicard opened this issue Oct 11, 2022 · 0 comments

Comments

@ypicard
Copy link

ypicard commented Oct 11, 2022

Hi,

Based on the current implementation, proxy method calls are not able to update the wrapped object private members. It is related to the No private property forwarding topic.

I was wondering if implementing the proposed solution in the above link would be acceptable for this project:

get(target, prop, receiver) {
    const value = target[prop];
    if (value instanceof Function) {
      return function (...args) {
        return value.apply(this === receiver ? target : this, args);
      };
    }
    return value;
}

I am not sure about side-effects and implications this could have for other use cases, but this does fix my issue.

If this is an option, I will gladly submit a PR. I will use a locally patched version of this library until then.

Thank you

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

No branches or pull requests

1 participant