showcase.rs 664 B

1234567891011121314151617181920212223242526
  1. //! A Showcase of all the useful examples
  2. //!
  3. //!
  4. //!
  5. fn main() {
  6. use_css_consumer(&cx, "mystyle");
  7. // at the global head of the app
  8. use_css_provider(&cx, |cfg| {});
  9. use_recoil_provider(&cx, |cfg| {});
  10. let recoil = use_recoil_api(&cx, |_| {});
  11. use_websocket_connection(&cx, move |cfg| {
  12. cfg.on_receive(move |event| match event.data::<Msg>() {
  13. Ok(msg) => match msg {
  14. a => recoil.set(&ATOM, 10),
  15. c => recoil.set(&ATOM, 20),
  16. _ => {}
  17. },
  18. Err(e) => {}
  19. });
  20. cfg.on_close(move |event| {});
  21. cfg.on_open(move |event| {});
  22. });
  23. }