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

Web Components Asynchrony #73

Open
raquo opened this issue Dec 19, 2020 · 0 comments
Open

Web Components Asynchrony #73

raquo opened this issue Dec 19, 2020 · 0 comments

Comments

@raquo
Copy link
Owner

raquo commented Dec 19, 2020

From uosis/laminar-web-components#6 (comment):

Yeah web components are asynchronous by design - there is WebComponentsReady event, similar to DOMReady, that you need to wait for before you can call methods on web components. See here and here for examples.

Thanks @uosis for the initial pointer!

This asynchrony is a problem because for example you apparently can't use the onMountFocus modifier on a web component, the timing is off. To solve the issue properly, I need a deeper understanding of Web Components loading timeline and the WebComponentsReady event. I need to know at least the following:

  • When exactly, and how many times does this event fire? Just once per document, in all cases, even if we add some web components to the page later? If it fires only once, how do I know whether it has been fired already or not at any given time, without listening to it?

  • Am I correct to assume that reading anything from the web component might fail until this event fires, but providing attributes will work? What about registering event listeners?

  • How much of this is convention of certain libraries like Polymer vs some kind of standard?

I could of course eventually figure out these kinds of things on my own, but I don't have a personal need for Web Components, so I can't afford to spend much time here. If anyone wants to provide additional info or advice on what needs to be done in Laminar to make Web Components usage smoother, this might end up getting resolved sooner.

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

No branches or pull requests

1 participant