Skip to content

Component initialisation #79

Answered by ivanceras
hchockarprasad asked this question in Q&A
Discussion options

You must be logged in to vote

@hchockarprasad, You have to manually call your Component's init function from your Application. Just like update in Component is also wired through your Application's update function. I haven't included a simplified example for this use-case, since I'm still stabilizing the method signatures of this init function in the Application and in the Component. However, A more advance usage is demonstrated here in the ultron editor, which I also wrote.

From the App's init function

    fn init(&mut self) -> Cmd<Self, Msg> {
        Cmd::batch([
            Cmd::new(|program| {
                program.add_window_event_listeners(vec![
                    on_mousemove(|me| Msg::WebEditorMsg(web_edit…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by hchockarprasad
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #78 on August 17, 2023 17:38.