-
Notifications
You must be signed in to change notification settings - Fork 53
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
Exposing public properties? #1
Comments
Hi @bestguy - I believe you might be able to do that using the var example = $('x-example')[0]._component;
example.report(); |
Thanks @developit - I'm a little weak on web components, but was looking at Polymer docs (https://www.polymer-project.org/1.0/docs/devguide/instance-methods) and it allows this syntax:
And call like so:
without the Any tips on how I might modify this to support? |
I think we'd just iterate over the methods on the component's prototype and hoist them (skipping the builtins like |
I've opened a PR to possibly address this. Initially I was using Just trying to allow the user retain some control over privacy, even though this is JS. :) Thoughts / comments welcome there, I could go either way. Would be easy enough to introspect on your own and pass that into the explicit api, so I'm leaning that way. /shrug |
I have created a sample repo with react hooks where accessing the exposed methods does not work unfortunately. I would love to get a proposal on how to fix this. |
@developit could you share some insight here? |
I came across a similar problem as @rburgst. The preact-custom-element documentation refers to its |
Hi, great library. I have a question on how to expose properties of a component to the DOM. It looks like you are iterating through the attributes to expose as the CustomElement prototype:
https://github.com/bspaulding/preact-custom-element/blob/master/src/index.js#L6
but am a little confused on what these would actually be. I mistakenly assumed I'd be able to define properties on the Preact component and automatically export them:
However this does not work:
What would be the best way to do this?
The text was updated successfully, but these errors were encountered: