[][src]Module mogwai::builder

A gizmo builder is used to create DOM elements. It adheres to the normal builder pattern and provides functions for wiring messages in and out of the DOM. Here is an example of using GizmoBuilder, Transmitter and Receiver to create a button that counts its own clicks:

extern crate mogwai;
use mogwai::prelude::*;

let (tx, rx) =
  txrx_fold(
    0,
    |n:&mut i32, _:&Event| -> String {
      *n += 1;
      if *n == 1 {
        "Clicked 1 time".to_string()
      } else {
        format!("Clicked {} times", *n)
      }
    }
  );

button()
  .rx_text("Clicked 0 times", rx)
  .tx_on("click", tx)
  .build().unwrap()
  .run().unwrap()

Modules

tags

Contains GizmoBuilder constructors for all html5 tags. Each of these constructor functions is shorthand for

Structs

GizmoBuilder

Construction and wiring for DOM elements. For an extensive list of constructor functions see tags.