Skip to content
karelsteinmetz edited this page May 19, 2016 · 2 revisions

In Global Scope

  • one store for one application state
  • application state:
  • is global state
  • is composition of sub states
  • actions are create by action factory with specified cursor and handler. Handler creates new instance of state or it can return the same state
  • Bobril is only for "rendering" (View)
  • Bobril component context (b.IBobrilCtx) should be used for intermediate state (drag & drop, input border color on focus etc.)

State

IState

  • common state marker interface
  • bfg - there is nothing to generate

IRouteComponentState

  • is marker interface for state of pages
  • pages which is layouts
  • bfg - goes to directory of imported state and generates there nested states

IComponentState

  • is marker interface for state of repeatable components
  • bfg - doesn't go to directory of imported state but stays in current directory and generates nested states

Example

//state.ts
import * as f from 'bobflux';

export interface ITodo {
    id: number;
    isDone: boolean;
    name: string;
}

export interface ITodosState extends f.IState {
    editedTodo: ITodo;
    todos: ITodo[];
}
//app.ts - main application file in bobril-build or systemjs
import * as f from 'bobflux';
import * as s from './states';

f.bootstrap(s.default());
Clone this wiki locally