Open vthg2themax opened 3 years ago
I just tested it and it works perfectly for me. Button 1 sends a command to the invoke handler that executes this code:
// build_html_dyn() just returns a string containing the html content.
// all of the javascript is inlined in the html
view.set_html(&crate::html::build_html_dyn()).unwrap();
Button 2 sends a different command that executes:
view.eval("test();").unwrap();
The test function just sets the innerText of button 1 to AAAA
window.test = () => {
window.libraryButton.innerText = 'AAAA';
};
The function is binded to the window object, this is the only way I get evaluated functions to work at all. Maybe that works for you too.
I am not sure if this is something that is supported, or if I am missing something, but after setting up an .invoke_handler(), and then running .set_html() from inside of it, I lose the ability for subsequent external.invoke calls to activate again.