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

Add widget context #10

Closed
StarArawn opened this issue Jul 20, 2024 · 0 comments · Fixed by #15
Closed

Add widget context #10

StarArawn opened this issue Jul 20, 2024 · 0 comments · Fixed by #15
Labels
enhancement New feature or request
Milestone

Comments

@StarArawn
Copy link
Owner

Widget context should exist local to the tree where it is spawned. API example:

// parent.rs
let context_entity = api.use_context::<T>(current_widget);
commands.entity(context_entity).spawn(MyContext);

// child.rs
let context_entity = api.use_context::<T>(current_widget);
let Ok(context) = context_query.get(context_entity) else {
    return;
}
@StarArawn StarArawn added the enhancement New feature or request label Jul 20, 2024
@StarArawn StarArawn mentioned this issue Jul 20, 2024
12 tasks
@StarArawn StarArawn added this to the v0.1 milestone Jul 20, 2024
@StarArawn StarArawn mentioned this issue Jul 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant