bouzuya/b-o-a 0.5.2 をつくった。詳細は 0.4.0...0.5.2 を参照してほしい。
変更点は次のとおりだ。
- boa-core の抽出
- boa-handler-* の追加
- bouzuya/boa-handler-dom@0.4.0
- bouzuya/boa-handler-history@0.2.0
- bouzuya/boa-handler-init@0.3.0
- bouzuya/boa-handler-request@0.2.0
built-in handler を持つようになったことで、 b-o-a は library から framework になった。「 b-o-a 0.5.x は framework になった最初の version 」と言っていい。今後は application の構造をより規定するようになる。
b-o-a 0.5.x は 0.4.0 に比べ、完成度を下げて、実用度を上げた。0.5.2 であれば b-o-a だけで簡単な SPA : Single Page Application はつくることができる。それは todomvc などの具体例で示していくつもりだ。
現状の app の entry point は次のような感じ。
import { run } from 'b-o-a'; import { init as dom } from 'b-o-a/handlers/dom'; const app = (action$, options) => { /* ... */ }; const render = (state, helpers) => { /* ... */ }; const main = () => { run((action$, options) => { const dom$ = dom({ render, root: 'div#app' }).handler(action$, options); return app(dom$, options); }); };
app
と dom(...).handler
がどちらも同じ Handler
の signature を持つ。このように framework の提供すべき機能を built-in handler で提供していくつもりだ。
ちなみに以前の b-o-a がほしい場合は boa-core を使うと良い。