feat!: client storage is read-only, storage.save and storage.delete removed
This commit is contained in:
@@ -37,7 +37,7 @@ const profile = client.player.value;
|
||||
const gold = profile?.balances?.find((b) => b.currency === 'gold')?.balance;
|
||||
const swords = profile?.items?.find((i) => i.item === 'sword')?.quantity ?? 0;
|
||||
|
||||
await client.storage.save('progress', JSON.stringify({ level: 7 }));
|
||||
const progress = client.storage.value?.items?.find((i) => i.type === 'progress')?.data;
|
||||
|
||||
client.dispose();
|
||||
```
|
||||
@@ -92,7 +92,7 @@ can also call directly:
|
||||
| Auth | `client.auth.loginWithDevice()`, `loginWithGoogle({ idToken })`, `loginWithApple({ idToken })`, `loginWithCustom({ customData })`, `linkWithGoogle(idToken)`, `linkWithApple(idToken)`, `linkWithCustom({ customData })`, `unlinkIdentity(provider)`, `logout()`, `isAuthenticated`, `onAuthStateChange(cb)` |
|
||||
| Player | `client.player` state: `player`, `identities`, `balances`, `items` |
|
||||
| Catalog currencies | `client.catalog` state (`Map<slug, CatalogCurrency>`) |
|
||||
| Storage | `client.storage` state + `.save(type, data)` / `.delete(type)` |
|
||||
| Storage | `client.storage` state, read-only (modules write it) |
|
||||
| Modules | `client.modules.call<T>(module, fn, args?, { moduleVersion? })`, usually through a generated client |
|
||||
|
||||
`balances` carries one entry per released currency and `items` one per
|
||||
|
||||
Reference in New Issue
Block a user