-
Notifications
You must be signed in to change notification settings - Fork 6
States
karelsteinmetz edited this page May 19, 2016
·
2 revisions
- 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.)
- is object
- is global state of application
- one instance is held in store
- default state must be set before first usage
- there're marker interfaces for your states
- bfg - [bobflux-gen] (https://github.com/karelsteinmetz/bobflux-gen) resolves/leads generating by those cursors.
- common state marker interface
- bfg - there is nothing to generate
- is marker interface for state of pages
- pages which is layouts
- bfg - goes to directory of imported state and generates there nested states
- 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
//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());