Skip to content

Commit

Permalink
Include Counter Example at home page of generated documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben-PH authored and MartinKavik committed May 3, 2020
1 parent c4afdcd commit b7a32a2
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,50 @@
//! Visit the [website](https://seed-rs.org/)
//!
//! See the [github Readme](https://github.com/seed-rs/seed) for details
//!
//!
//! ## Counter Example
//! ```
//! use seed::{prelude::*, *};
//!
//! // `init` describes what should happen when your app started.
//! fn init(_: Url, _: &mut impl Orders<Msg>) -> Model {
//! Model::default()
//! }
//!
//! // `Model` describes our app state.
//! type Model = i32;
//!
//! // `Msg` describes the different events you can modify state with.
//! enum Msg {
//! Increment,
//! }
//!
//! // `update` describes how to handle each `Msg`.
//! fn update(msg: Msg, model: &mut Model, _: &mut impl Orders<Msg>) {
//! match msg {
//! Msg::Increment => *model += 1,
//! }
//! }
//!
//! // `view` describes what to display.
//! fn view(model: &Model) -> Node<Msg> {
//! div![
//! "This is a counter: ",
//! C!["counter"],
//! button![
//! model,
//! ev(Ev::Click, |_| Msg::Increment),
//! ],
//! ]
//! }
//!
//! #[wasm_bindgen(start)]
//! pub fn start() {
//! // Mount the `app` to the element with the `id` "app".
//! App::start("app", init, update, view);
//! }
//! ```

//#![deny(missing_docs)]
#![forbid(unsafe_code)]
Expand Down

0 comments on commit b7a32a2

Please sign in to comment.