[][src]Crate seed

See readme for details.

Re-exports

pub use crate::dom_types::Listener;
pub use crate::fetch::Method;
pub use crate::fetch::Request;
pub use crate::fetch::spawn_local;
pub use crate::routing::push_route;

Modules

dom_types

This module contains structs and enums that represent dom types, and their parts. These are the types used internally by our virtual dom.

fetch

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

prelude

Introduce El and Tag into the global namespace for convenience (El 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. Expose the wasm_bindgen prelude, and lifecycle hooks.

routing
shortcuts

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)

storage

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

a
abbr
address
applet
article
aside
attrs

Provide a shortcut for creating attributes.

b
bdi
bdo
blockquote
br
button
canvas
circle
cite
class

Convenience macro. Ideal when there are multiple classes, and no other attrs.

code
custom

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.

data
dd
defs
del
dfn
dir
div
dl
dt
ellipse
em
embed
fieldset
figcaption
figure
footer
form
g
h1
h2
h3
h4
h5
h6
hashmap_string

A HashMap literal, where the keys and valsmust implement ToString.

header
hgroup
hr
i
id

Convenience macro, for brevity.

iframe
image
img
input
ins
kbd
label
legend
li
line
linear_gradient
log

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.

main
map
mark
marker
mask
mesh
mesh_gradient
meter
nav
noscript
ol
optgroup
option
output
p
path
polygon
polyline
pre
progress
radial_gradient
rect
routes

A HashMap literal, where the keys must implement ToString.

script
section
select
span
stop
strong
style

Provide a shortcut for creating styles.

sub
sup
svg
text
textarea
track
tref
tspan
ul
use
video

Structs

App

Functions

document

Convenience function to access the web_sys DOM document.

empty

Create an element flagged in a way that it will not be rendered. Useful in ternary operations.

log

A convenience function for logging to the web browser's console. See also the log! macro, which is more flexible.

run

App initialization: Collect its fundamental components, setup, and perform an initial render.

set_interval

A high-level wrapper for web_sys::window.set_interval_with_callback_and_timeout_and_arguments_0: https://rustwasm.github.io/wasm-bindgen/examples/closures.html https://rustwasm.github.io/wasm-bindgen/api/web_sys/struct.Window.html

to_html_el

See to_input

to_input

Convenience function used in event handling: Convert an event target to an input element; eg so you can take its value.

to_kbevent

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.

to_mouse_event

See to_kbevent

to_select

See to_input

to_textarea

See to_input

window

Convenience function to avoid repeating expect logic.