[][src]Type Definition kayrx_ui::fabric::state::Subscription

type Subscription<State> = fn(_: &State);

Function signature for a subscription.

A Subscription will be called, whenever an action is dispatched (and reaches the reducer). It receives a reference to the current state, which might or might not be used.

Example

let mut store = Store::new(reducer, initial_state);

let listener: Subscription<State> = |state: &State| {
    println!("Something changed! New value: {}", state);
};

store.subscribe(listener);