alloc / alloc/saus

Make state modules more ergonomic

オープン
#52 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る
proposal roadmap
主要言語
TypeScript
スター
38
フォーク
1
PR マージ指標
30日以内にマージされた PR はありません

説明

Currently, state modules typically look like normal variables (lowercased), and you use their `.get` or `.load` methods as appropriate. When unwrapping a state module into its raw value, it can be awkward to decide on what the unwrapped value's variable will be named. This proposal is a possible solution.

```ts
import { defineStateModule } from 'saus/client'

export const [getFoo, loadFoo] = defineStateModule(
'foo',
async function() {
// TODO: Load the foo
}
)
```

With this pattern, the awkwardness is avoided:

```ts
import { getFoo, loadFoo } from '../state/foo'

let foo = getFoo(1, 2, 3)

foo = await loadFoo(3, 4, 5)
```

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。