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

ES6 Proxy Like Property Accessor #1359

Closed
ljamesjr85 opened this issue Jul 31, 2023 · 3 comments
Closed

ES6 Proxy Like Property Accessor #1359

ljamesjr85 opened this issue Jul 31, 2023 · 3 comments
Labels

Comments

@ljamesjr85
Copy link

I'm asking this question a little out of ignorance about how performant or not performant the ES6 proxy is. But is there any sort of mechanism to assign a c++ method to be called when an undefined* property or index is used from JS?

*undefined - meaning not part of the prototype created by "DefineClass" or added to the instance of the class when its instantiated.

The ES6 Proxy would more than suffice for what I want to do. However based on some testing I've seen people online do, it seems like there is a noticeable slow down when you use a proxy. I am not really concerned about how performant it would be for small use cases. But what I am building could potentially access and iterate over 10s-100s of millions of properties that really only exist on a wrapped object. So if I can get some efficiency out of writing an addon class I would rather do that than use a proxy.

@KevinEady
Copy link
Contributor

Hi @ljamesjr85 ,

I think your concern remotely relates to #1114. Unfortunately there is no Node-API to achieve what you are trying to accomplish. I think the Proxy method is the only way. Take a look at the thread and see the conversation for some details.

Copy link
Contributor

github-actions bot commented Nov 3, 2023

This issue is stale because it has been open many days with no activity. It will be closed soon unless the stale label is removed or a comment is made.

@github-actions github-actions bot added the stale label Nov 3, 2023
@mhdawson
Copy link
Member

I'm going to close this as answered. Please let us know if that was not the right thing to do.

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

No branches or pull requests

3 participants