Expand description
See readme for details.
Modules
This module contains structs and enums that represent dom types, and their parts.
These are the types used internally by our virtual dom.
High-level interface for web_sys HTTP requests.
https://rustwasm.github.io/wasm-bindgen/examples/fetch.html
See https://rustwasm.github.io/wasm-bindgen/reference/js-promises-and-rust-futures.html
https://rustwasm.github.io/wasm-bindgen/api/web_sys/struct.Request.html
https://rustwasm.github.io/wasm-bindgen/api/wasm_bindgen_futures/
https://rustwasm.github.io/wasm-bindgen/api/web_sys/struct.Response.html
Introduce El into the global namespace for convenience (It will be repeated
often in the output type of components), and UpdateEl, which is required
for element-creation macros, input event constructors, and the History struct.
This file exports helper macros for element creation, populated by a higher-level macro,
and macros for creating the parts of elements. (attrs, style, events)
Allows use of the Web Storage API / local storage.
MDN docs:
https://developer.mozilla.org/en-US/docs/Web/API/Storage
web-sys docs:
https://rustwasm.github.io/wasm-bindgen/api/web_sys/struct.Storage.html
Example syntax:
https://github.com/rustwasm/wasm-bindgen/blob/master/examples/todomvc/src/store.rs
Macros
Create macros exposed to the package that allow shortcuts for Dom elements.
In the matching mattern below, we match the name we want to use with the name under
the seed::dom_types::Tag enum. Eg the div! macro uses seed::dom_types::Tag::Div.
Provide a shortcut for creating attributes.
A convenience function for logging to the web browser’s console. We use
a macro instead of a function to allow flexible input types, and multiple
inputs.
Provide a shortcut for creating styles.
Functions
Convenience function to access the web_sys DOM document.
Create an element flagged in a way that it will not be rendered. Useful
in ternary operations.
A convenience function for logging to the web browser’s console. See also
the log! macro, which is more flexible.
Push a new state to the window’s history, and append a custom path to the url. This
is an improtant client-side routing feature.
https://rustwasm.github.io/wasm-bindgen/api/web_sys/struct.History.html#method.push_state_with_url
https://developer.mozilla.org/en-US/docs/Web/API/History_API
App initialization: Collect its fundamental components, setup, and perform
an initial render.
See to_input
Convenience function used in event handling: Convert an event target
to an input element; eg so you can take its value.
Convert a web_sys::Event to a web_sys::KeyboardEvent. Useful for extracting
info like which key has been pressed, which is not available with normal Events.
See to_input
See to_input