-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Third-party components embedding #90
Comments
I'm looking forward to this. My use case is: I'm writing a game with the unrust webgl engine, and want to have a HUD GUI overlay based on html with yew (also a chat text field etc.) so I need two way communication between the yew app and the wasm game.. |
Missing label:
|
@hamza1311 , if this is not been solved, can you please assign this ticket to me? |
Don't portals solve this? I'm not sure what the solution here is. Do you have anything in mind, @tieje? CC: @WorldSEnder |
I don't know. Sorry, but I am still yet a learner. |
Portals can get you there, to some degree. You could for example render something akin to // Create your third-party component somehow, probably by calling to JS
// Should not be in the view function directly, but in use_state or the component's create
let third_party_element: web_sys::Element = todo!();
// Now, in the view function you can use a portal to let yew handle the children of that element
// These could be for example slotted
let portal_to_children = yew::html::create_portal(html! {
<>
<p slot="some-slot">{"I will be rendered as a child of third_party_element"}</p>
<p slot="some-other-slot">{"E.g. 'slot' can be used with web components"}</p>
</>
}, third_party_element.clone());
// Render both the original element, and the portal
html! {
<>
{portal_to_children}
{VDom::VRef(third_party_element.into())}
</>
} Note: I haven't thought about event propagation/bubbling with the above, but I think it should work fine. |
According to #83 we need a capability to embed third-party components which lives in own lifecycle, like Ace.
The text was updated successfully, but these errors were encountered: