[][src]Crate ruukh

Ruukh - Introduction

Welcome to Ruukh, the frontend web framework.

This API reference tries to be both helpful for the users as well as anybody who wants to understand how this framework works. So, if you find anything you do not understand or is wrong here, feel free to open an issue/PR at github.

To create an app, you must first implement a root component which neither accepts props nor accepts events. This component is then mounted on a DOM node like so:

Example

#![feature(proc_macro_hygiene, decl_macro)]

use ruukh::prelude::*;
use wasm_bindgen::prelude::*;

#[component]
#[derive(Lifecycle)]
struct MyApp;

impl Render for MyApp {
    fn render(&self) -> Markup<Self> {
        html! {
            "Hello World!"
        }
    }
}

#[wasm_bindgen]
pub fn run() {
    App::<MyApp>::new().mount("app");
}

Here, "app" is the id of an element where you want to mount the App.

Note: Docs on macros are located here.

Modules

component

This module defines traits the user needs to implement a Ruukh Component.

prelude

Things you'll require to build the next great App. Just glob import the prelude and start building your app.

reexports

Things the proc-macro uses without bugging the using to import them.

vdom

The Virtual DOM library which backs the ruukh frontend framework.

Structs

App

The main entry point to use your component and run it on the browser.

MessageReceiver

The receiving end of the message port which notifies the app for any state changes.

Traits

AppMount

Trait to get an element on which the App is going to be mounted.

Type Definitions

Markup

A VDOM Markup which is generated by using html! macro.