Beta v0.4.1
Alier
クリーンで一貫性のある、
スケーラブルなアプリ開発を。
フロントエンドからバックエンドまで──
直感的なアーキテクチャ
Model で状態を管理し、View でイベントを受け取る。
ボタンをクリックして、Alier のリアクティブなデータフローを体験できます。
1// 1. Model: 状態を管理 (Singleton)
2class CounterModel extends AlierModel {
3#count = 0;
4onChange = new MessagePorter();
5
6countUp() {
7this.#count++;
8this.onChange.post(Alier.message("onChange", "", { count: this.#count }));
9}
10
11countDown() {
12this.#count--;
13this.onChange.post(Alier.message("onChange", "", { count: this.#count }));
14}
15}
16
17// 2. View: イベントをメッセージとして処理
18class CounterView extends ViewLogic {
19async messageHandler(msg) {
20return await msg.deliver({
21plusBtn: () => Alier.Model.countUp(),
22minusBtn: () => Alier.Model.countDown(),
23onChange: (m) => this.display.value = m.param.count,
24});
25}
26}
27
28// 3. Setup: アプリケーション起動
29AlierView.setStyleSheets(true, "ColorTheme_Nihonkai.css", "AlierGlassy.css");
30Alier.View.attach(new CounterView());
Model
CounterModel { #count: 0 } onChange.post(...)
0
[ready] Alier.View.attach(new CounterView())
Download
Latest Release: v0.4.1 (beta)