mirror of
https://github.com/yewstack/yew.git
synced 2025-12-08 21:26:25 +00:00
* Naive implementation of destroy app * Move functions get_component_link and destroy The function get_component_link and destroy on App does not require Component::Properties to be Default. So move them to their own impl block. * Change the fn signatures for the other mount fns too * Add example of how to use the apps dynamically * Rename example * Change title of example html file * Update examples/dyn_create_destroy_apps/src/counter.rs Co-authored-by: Simon <simon@siku2.io> * Change fn signatures of App to not take Self * app.rs thorugh to public API: only make it possible to create an instance of an App by mounting it. And only make it possible to mount an App by creating it. This prevents double mounting. * Change Scope::mount_in_place to take &self instead of self, because it doesn't have too. * Fix examples to compile with new App signature * Fix tests to compile with new App signature * Remove pub pulic App::mount* API * Make the documentation compile again with the new start_app API * Make the examples compile again with the new start_app API * Make the yew packages compile again with the new start_app API * rename module yew::app to yew::app_handle * Fix identation in styling file for dyn_create_destroy_app ex * Fix naming in examples/dyn_create_destroy_apps/README.md Co-authored-by: Simon <simon@siku2.io> * Use Self instead of AppHandle to create AppHandle Co-authored-by: Simon <simon@siku2.io> * Fix the start_app_in_body docs Co-authored-by: Simon <simon@siku2.io> * Remove comparison with Elm in the start_app docs Co-authored-by: Simon <simon@siku2.io> * Fix english in dyn_create_destroy_apps example Co-authored-by: Simon <simon@siku2.io> * Impl Deref instead of AsRef for AppHandle * Formatting * Remove AppHandle::new use Default trait instead * Rename the Yew::start_app* function names * Revert "Remove AppHandle::new use Default trait instead" This reverts commit 97e4897c1edafac34e012f13bc2b5084f68f8dce. * remove default impl for AppHandle * Make the tests compile again * Make the examples compile again * Add dyn_create_destroy_apps to examples/README.md * Remove mount_to_body_with_props Co-authored-by: Simon <simon@siku2.io> * Use yew getters instead of query selectors Co-authored-by: Simon <simon@siku2.io> * Remove AppHandle::new * Remove unused function * code style fix * Fix compile error * Add func set_custom_panic_hook This commit adds the function set_custom_panic_hook. In addition Yew will now check if a custom panic is registered when one of start_app* functions are called, if that is not the case a default panic hook is registered. * Fix docs for set_custom_panic_hook Co-authored-by: Simon <simon@siku2.io> Co-authored-by: Nicklas Warming Jacobsen <nwj@skybox.gg> Co-authored-by: Simon <simon@siku2.io>
Two Apps Example
This example runs two Yew apps which communicate with each other.
Concepts
The example illustrates how one can take control of the mounting process which is usually done by yew::start_app.
Improvements
Instead of using the same component type twice, the example could use two entirely different components that communicate with each other. One of the components could even accept a generic "remote" component using a trait.
This example is very similar to mount_point.
The two should be merged into a single example.