Skip to content

Instantly share code, notes, and snippets.

@bouzuya
Created March 8, 2016 09:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bouzuya/fe773f236414f20237e9 to your computer and use it in GitHub Desktop.
Save bouzuya/fe773f236414f20237e9 to your computer and use it in GitHub Desktop.
b-o-a の構造の説明

b-o-a の構造を説明します。

b-o-a の構造は、循環する Observer Pattern です。Subject -> App -> Subject ... で循環します。通知されるデータの形式は A: Action です。A は 処理の type と data をまとめたものです。

b-o-a のアプリケーションはただひとつの関数 App からなります。

type App = (action$: O<A>) => O<A>;

O は Observable 、A は Action です。

type O<T> = Observable<T>;
type A<T> = { type: string; data: T; };

App は、 Subject から流れる A を受けるための action$ を取り、次に Subject にに流す A を渡すための O<A> を返します。

実行するためには run を使います。

type run = (app: App) => void;

まとめると次のものが b-o-a の基本構造です。

type O<T> = Observable<T>;
type A<T> = { type: string; data: T; };
type App = (action$: O<A>) => O<A>;
type run = (app: App) => void;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment