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

Deeply wrap nested functions inside objects in callbacks #64

Open
sgarfinkel opened this issue Jun 10, 2024 · 1 comment
Open

Deeply wrap nested functions inside objects in callbacks #64

sgarfinkel opened this issue Jun 10, 2024 · 1 comment

Comments

@sgarfinkel
Copy link

Is your feature request related to a problem? Please describe.
Basically what this says on the tin. I am using post-me for interoperating with React components on within the iframe, and it's particularly convenient in this case to pass a single object-type argument with values. Unfortunately, the existing implementation does not recurse into object arguments (https://github.com/alesgenova/post-me/blob/main/packages/core/src/handles.ts#L224-L231C10). I would love if this could be implemented as it should be fairly straightforward.

Describe the solution you'd like
Objects should be traversed and any property of type function should be wrapped.

Describe alternatives you've considered
All callbacks need to be moved out of the object into the top-level function call, which is not ideal.

Additional context
Add any other context or screenshots about the feature request here.

@sgarfinkel sgarfinkel changed the title Deeply wrap nested functions in callbacks Deeply wrap nested functions inside objects in callbacks Jun 10, 2024
@alesgenova
Copy link
Owner

Hi, thank you for reporting this.

It can be a useful feature, but need to think a couple of things through:
Any function in the object will intrinsically be turned into an asynchronous method.
But if we restrict the callbacks to not returning anything (such is the case in the current callback implementation), then it really doesn't matter.

Would you be interested in opening a PR for this feature?

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

2 participants