Crate silkenweb

source ·
Expand description

A library for building reactive web apps

Overview

Quick Start

First, install the wasm32 target:

rustup target add wasm32-unknown-unknown

Then install trunk:

cargo install trunk --locked

To run the example counter:

cd examples/counter
trunk serve --open

Feature Flags

weak-refs

Use Javascript weak references to manage event callbacks. This improves performance but must be enabled in wasm-bindgen. See the trunk documentation for details on how to do this using data-weak-refs.

See caniuse for current browser support.

declarative-shadow-dom

Print Declarative Shadow DOM when server side rendering. Hydration will correctly deal with shadow DOM regardless of this flag. See caniuse for browser support. Polyfills are available.

css-transpile

Enable CSS transpilation for css!. This can significantly increase build time, so is presented as an opt-in feature.

Learning

There’s extensive documentation on each module in this crate, along with many other examples in the examples folder.

Reactivity is provided by futures_signals. It would be helpful to familiarize yourself using futures_signals::tutorial.

Modules

  • Animation time signals.
  • Traits for defining attribute types.
  • Document utilities.
  • An abstraction for the underlying DOM.
  • HTML element types.
  • Hydrate the document with event handlers.
  • Generic DOM types.
  • Commonly used imports, all in one place.
  • Tools for working with Javascript properties.
  • URL based routing.
  • Local and session storage.
  • Microtask and render queue tools.
  • Utilities for tacking time.
  • Abstract over the signal/value-ness of types.
  • Window utilities.

Macros

Functions

Attribute Macros

Derive Macros