From 1738ed019bdc6e93d2f2926d7f3a102402aca412 Mon Sep 17 00:00:00 2001 From: Yoshua Wuyts Date: Mon, 16 May 2016 01:55:04 +0700 Subject: [PATCH] docs: tighten concepts --- README.md | 39 ++++++++++++++++++--------------------- 1 file changed, 18 insertions(+), 21 deletions(-) diff --git a/README.md b/README.md index db7d12f..f5ad2b5 100644 --- a/README.md +++ b/README.md @@ -56,29 +56,26 @@ document.body.appendChild(tree) ``` ## Concepts -- __state:__ a single object that contains all application state, should only - ever be modified by `reducers` +- __state:__ a single object that contains __all__ application state - __reducers:__ synchronous functions that modify `state` -- __effects:__ asynchronous functions that perform IO. Effects can call - `send()` when done to handle results -- __subscriptions:__ streams of data that can either be written to or read from +- __effects:__ asynchronous functions that emit an `action` when done +- __subscriptions:__ read-only data sources that emit `action`s for new data ```txt - ┌───────────────────────────────┐ - │ │ ┌────────┐ - │ ┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┐ │ │ User │ - │ ┌─────────────────┐ │ └────────┘ - ├────┼─│ Subscriptions │ │ │ │ - │ └─────────────────┘ │ ▼ - │ │ ┌─────────────────┐ │ │ ┌────────┐ ┌────────┐ - └──────│ Effects │◀─────┼──────┤ DOM │◀───────────│ Views │ - │ └─────────────────┘ │ Actions └────────┘ DOM tree └────────┘ - ┌─────────────────┐ │ ▲ - │ │ Reducers │◀┼────┘ │ - └─────────────────┘ │ - │ │ │ ┌────────┐ │ - └─────────────────────▶│ Router │─────────────────┘ - └ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┘ State └────────┘ State - Model + ┌───────────────────────────┐ ┌────────┐ + │ ┌ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┐ │ │ User │ + │ ┌─────────────────┐ │ └────────┘ + ├──┼─│ Subscriptions │ │ │ │ + │ └─────────────────┘ │ ▼ + │ │ ┌─────────────────┐ │ │ ┌────────┐ ┌────────┐ + └────│ Effects │◀───┼──────│ DOM │◀───────────│ Views │ + │ └─────────────────┘ │ Actions └────────┘ DOM tree └────────┘ + ┌─────────────────┐ │ ▲ + │ │ Reducers │◀┼──┘ │ + └─────────────────┘ │ + │ │ │ ┌────────┐ │ + └───────────────────▶│ Router │─────────────────┘ + └ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ┘ State └────────┘ State + Model ``` ## Effects