@indiegems/gem-web-sdk 18.1.1 → 19.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +18 -0
- package/dist/function.d.ts +16 -2
- package/dist/game.d.ts +16 -2
- package/dist/gem-web-sdk.conformance.js +3 -3
- package/dist/gem-web-sdk.esm.js +1 -1
- package/dist/gem-web-sdk.function.js +3 -3
- package/dist/gem-web-sdk.game.js +3 -3
- package/dist/gem-web-sdk.min.js +3 -3
- package/dist/gem-web-sdk.sdk.js +3 -3
- package/dist/gem-web-sdk.server.js +1 -1
- package/dist/sdk.d.ts +16 -2
- package/docs/api/api-reference-function.md +247 -2
- package/docs/api/api-reference-game.md +254 -3
- package/docs/api/api-reference-server.md +1 -1
- package/docs/api/reference.json +661 -5
- package/docs/arcade-and-store.md +145 -6
- package/docs/changelog.md +18 -0
- package/docs/getting-started.md +1 -1
- package/docs/inventory-and-catalogs.md +13 -0
- package/docs/manifest.json +12 -12
- package/docs/server-bundles.md +8 -2
- package/docs/what-a-game-must-do.md +22 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# The function surface — API reference
|
|
2
2
|
|
|
3
|
-
Generated from `@indiegems/gem-web-sdk/function`
|
|
3
|
+
Generated from `@indiegems/gem-web-sdk/function` v19.0.1, the version of the package this file ships in. Every symbol below carries an explicit anchor, its `anchor` in `reference.json` beside this file.
|
|
4
4
|
|
|
5
5
|
`@indiegems/gem-web-sdk/function` exports exactly the symbols on this page and nothing else.
|
|
6
6
|
|
|
@@ -3165,6 +3165,127 @@ was already claimed from it — the progress resets, the rewards stay.
|
|
|
3165
3165
|
| `progressionId` | `string` |
|
|
3166
3166
|
| `signal` | `AbortSignal` |
|
|
3167
3167
|
|
|
3168
|
+
<a id="gamepass"></a>
|
|
3169
|
+
|
|
3170
|
+
## GamePass
|
|
3171
|
+
|
|
3172
|
+
```ts
|
|
3173
|
+
interface GamePass
|
|
3174
|
+
```
|
|
3175
|
+
|
|
3176
|
+
One pass games may see, and whether this player holds it. Listed whether they
|
|
3177
|
+
hold it or not, and this is everything a game learns about it.
|
|
3178
|
+
|
|
3179
|
+
<a id="gamepass-pass"></a>
|
|
3180
|
+
|
|
3181
|
+
## GamePass.pass
|
|
3182
|
+
|
|
3183
|
+
```ts
|
|
3184
|
+
readonly pass: string
|
|
3185
|
+
```
|
|
3186
|
+
|
|
3187
|
+
The pass's offering slug, such as `vip`. Stable and not localized: key on this.
|
|
3188
|
+
|
|
3189
|
+
<a id="gamepass-held"></a>
|
|
3190
|
+
|
|
3191
|
+
## GamePass.held
|
|
3192
|
+
|
|
3193
|
+
```ts
|
|
3194
|
+
readonly held: boolean
|
|
3195
|
+
```
|
|
3196
|
+
|
|
3197
|
+
Whether the player holds it right now.
|
|
3198
|
+
|
|
3199
|
+
<a id="gamepass-endsat"></a>
|
|
3200
|
+
|
|
3201
|
+
## GamePass.endsAt
|
|
3202
|
+
|
|
3203
|
+
```ts
|
|
3204
|
+
readonly endsAt: string | null
|
|
3205
|
+
```
|
|
3206
|
+
|
|
3207
|
+
When the player stops holding it, RFC 3339 in UTC, grace and any queued
|
|
3208
|
+
period included. `null` when it is not held, and when it is held with no
|
|
3209
|
+
end, so read [GamePass.held](#gamepass-held) first: `null` alone never means ended.
|
|
3210
|
+
|
|
3211
|
+
<a id="passesevent"></a>
|
|
3212
|
+
|
|
3213
|
+
## PassesEvent
|
|
3214
|
+
|
|
3215
|
+
```ts
|
|
3216
|
+
type PassesEvent = "changed"
|
|
3217
|
+
```
|
|
3218
|
+
|
|
3219
|
+
The events [PassesApi.on](#passesapi-on) emits.
|
|
3220
|
+
|
|
3221
|
+
<a id="passesapi"></a>
|
|
3222
|
+
|
|
3223
|
+
## PassesApi
|
|
3224
|
+
|
|
3225
|
+
```ts
|
|
3226
|
+
interface PassesApi
|
|
3227
|
+
```
|
|
3228
|
+
|
|
3229
|
+
Which store passes the player holds, for the passes the platform lets games
|
|
3230
|
+
see. Reached as `gem.me.passes`. VIP is the pass `vip`.
|
|
3231
|
+
|
|
3232
|
+
Use it to DRAW a door open or shut, never to decide: it runs in the player's
|
|
3233
|
+
browser. What a pass unlocks is decided by your function or server.
|
|
3234
|
+
|
|
3235
|
+
Reads reject with a `GemApiError`, as every `gem.me` read does. That is
|
|
3236
|
+
unknown, not "not held", so keep what you drew. A guest reads as not holding.
|
|
3237
|
+
|
|
3238
|
+
**Guides.** [arcade-and-store](../arcade-and-store.md)
|
|
3239
|
+
|
|
3240
|
+
<a id="passesapi-list"></a>
|
|
3241
|
+
|
|
3242
|
+
## PassesApi.list
|
|
3243
|
+
|
|
3244
|
+
```ts
|
|
3245
|
+
list(): Promise<readonly GamePass[]>
|
|
3246
|
+
```
|
|
3247
|
+
|
|
3248
|
+
Every pass games may see, held or not, ordered by slug. Empty when the
|
|
3249
|
+
platform marks none. Always a fresh read; callers at the same moment share
|
|
3250
|
+
one request.
|
|
3251
|
+
|
|
3252
|
+
<a id="passesapi-get"></a>
|
|
3253
|
+
|
|
3254
|
+
## PassesApi.get
|
|
3255
|
+
|
|
3256
|
+
```ts
|
|
3257
|
+
get(pass: string): Promise<GamePass>
|
|
3258
|
+
```
|
|
3259
|
+
|
|
3260
|
+
One pass by its slug. A pass the platform does not list reads as not held,
|
|
3261
|
+
so a door for a pass that is not on sale yet simply stays shut.
|
|
3262
|
+
|
|
3263
|
+
| Parameter | Type |
|
|
3264
|
+
| --- | --- |
|
|
3265
|
+
| `pass` | `string` |
|
|
3266
|
+
|
|
3267
|
+
<a id="passesapi-on"></a>
|
|
3268
|
+
|
|
3269
|
+
## PassesApi.on
|
|
3270
|
+
|
|
3271
|
+
```ts
|
|
3272
|
+
on(event: "changed", listener: (passes: readonly GamePass[]) => void): () => void
|
|
3273
|
+
```
|
|
3274
|
+
|
|
3275
|
+
Hear the list change, with the new list, so a door opens right after a
|
|
3276
|
+
purchase and locks again when the pass ends. Returns a function that stops
|
|
3277
|
+
listening.
|
|
3278
|
+
|
|
3279
|
+
While something listens, the SDK reads again after a `gem.store` purchase
|
|
3280
|
+
answers, when one settles, on resume (so a purchase in the Arcade's own
|
|
3281
|
+
store is heard), after a sign-in and when a held pass ends. It says
|
|
3282
|
+
something only if the answer differs. Never fires in a function.
|
|
3283
|
+
|
|
3284
|
+
| Parameter | Type |
|
|
3285
|
+
| --- | --- |
|
|
3286
|
+
| `event` | `"changed"` |
|
|
3287
|
+
| `listener` | `(passes: readonly GamePass[]) => void` |
|
|
3288
|
+
|
|
3168
3289
|
<a id="saverecord"></a>
|
|
3169
3290
|
|
|
3170
3291
|
## SaveRecord
|
|
@@ -3923,6 +4044,130 @@ readonly progressions: ProgressionsApi
|
|
|
3923
4044
|
Progressions this entity is working through — a projection over the same
|
|
3924
4045
|
cached snapshot [EntityScope.inventory](#entityscope-inventory) serves.
|
|
3925
4046
|
|
|
4047
|
+
<a id="playerscope"></a>
|
|
4048
|
+
|
|
4049
|
+
## PlayerScope
|
|
4050
|
+
|
|
4051
|
+
```ts
|
|
4052
|
+
interface PlayerScope
|
|
4053
|
+
```
|
|
4054
|
+
|
|
4055
|
+
What the signed-in player has in your game: everything a character has, and
|
|
4056
|
+
the store passes they hold. Reached as `gem.me`.
|
|
4057
|
+
|
|
4058
|
+
**Guides.** [saving-player-progress](../saving-player-progress.md)
|
|
4059
|
+
|
|
4060
|
+
<a id="playerscope-settings"></a>
|
|
4061
|
+
|
|
4062
|
+
## PlayerScope.settings
|
|
4063
|
+
|
|
4064
|
+
```ts
|
|
4065
|
+
readonly settings: SettingsApi
|
|
4066
|
+
```
|
|
4067
|
+
|
|
4068
|
+
Small named values your game chooses to persist — a difficulty, a control
|
|
4069
|
+
scheme, a last-used loadout.
|
|
4070
|
+
|
|
4071
|
+
Per key, so two settings written from two places do not overwrite each
|
|
4072
|
+
other. For a whole document of progress, use [EntityScope.saves](#entityscope-saves).
|
|
4073
|
+
|
|
4074
|
+
<a id="playerscope-inventory"></a>
|
|
4075
|
+
|
|
4076
|
+
## PlayerScope.inventory
|
|
4077
|
+
|
|
4078
|
+
```ts
|
|
4079
|
+
readonly inventory: InventoryApi
|
|
4080
|
+
```
|
|
4081
|
+
|
|
4082
|
+
What this player owns — items, and the progressions they are working
|
|
4083
|
+
through. Reads are cached; writes go through
|
|
4084
|
+
[EntityScope.mutations](#entityscope-mutations).
|
|
4085
|
+
|
|
4086
|
+
<a id="playerscope-currencies"></a>
|
|
4087
|
+
|
|
4088
|
+
## PlayerScope.currencies
|
|
4089
|
+
|
|
4090
|
+
```ts
|
|
4091
|
+
readonly currencies: CurrenciesApi
|
|
4092
|
+
```
|
|
4093
|
+
|
|
4094
|
+
Currency balances.
|
|
4095
|
+
|
|
4096
|
+
A currency the player holds none of is simply absent rather than present as
|
|
4097
|
+
zero, so read it as a lookup with a default rather than a list to iterate.
|
|
4098
|
+
|
|
4099
|
+
<a id="playerscope-mutations"></a>
|
|
4100
|
+
|
|
4101
|
+
## PlayerScope.mutations
|
|
4102
|
+
|
|
4103
|
+
```ts
|
|
4104
|
+
readonly mutations: MutationsApi
|
|
4105
|
+
```
|
|
4106
|
+
|
|
4107
|
+
Changing what this player has — spending currency, granting items, running
|
|
4108
|
+
a crafting recipe, advancing a progression.
|
|
4109
|
+
|
|
4110
|
+
Separate from [EntityScope.inventory](#entityscope-inventory) on purpose: reads are cached and
|
|
4111
|
+
safe to repeat, writes are neither, and one object holding both makes that
|
|
4112
|
+
distinction invisible where you call it.
|
|
4113
|
+
|
|
4114
|
+
<a id="playerscope-saves"></a>
|
|
4115
|
+
|
|
4116
|
+
## PlayerScope.saves
|
|
4117
|
+
|
|
4118
|
+
```ts
|
|
4119
|
+
readonly saves: SavesApi
|
|
4120
|
+
```
|
|
4121
|
+
|
|
4122
|
+
Saved progress — a world, a campaign, a replay. One document per key.
|
|
4123
|
+
|
|
4124
|
+
The line against [EntityScope.settings](#entityscope-settings) is what the value is, not how
|
|
4125
|
+
big it is: a setting is a value your game names, a save is an opaque
|
|
4126
|
+
document the platform stores and hands back. A chosen difficulty is a
|
|
4127
|
+
setting; the campaign it applies to is a save.
|
|
4128
|
+
|
|
4129
|
+
**Every save key must be declared in your game config first.** Writing to an
|
|
4130
|
+
undeclared key fails with a message naming it.
|
|
4131
|
+
|
|
4132
|
+
**Guides.** [saving-player-progress](../saving-player-progress.md)
|
|
4133
|
+
|
|
4134
|
+
<a id="playerscope-orders"></a>
|
|
4135
|
+
|
|
4136
|
+
## PlayerScope.orders
|
|
4137
|
+
|
|
4138
|
+
```ts
|
|
4139
|
+
readonly orders: OrdersApi
|
|
4140
|
+
```
|
|
4141
|
+
|
|
4142
|
+
This entity's order history — a read-only record of changes that happened.
|
|
4143
|
+
|
|
4144
|
+
Creating an order is [EntityScope.mutations](#entityscope-mutations); this answers "what
|
|
4145
|
+
happened" and "did my write land" (`orders.get(orderId)`).
|
|
4146
|
+
|
|
4147
|
+
<a id="playerscope-progressions"></a>
|
|
4148
|
+
|
|
4149
|
+
## PlayerScope.progressions
|
|
4150
|
+
|
|
4151
|
+
```ts
|
|
4152
|
+
readonly progressions: ProgressionsApi
|
|
4153
|
+
```
|
|
4154
|
+
|
|
4155
|
+
Progressions this entity is working through — a projection over the same
|
|
4156
|
+
cached snapshot [EntityScope.inventory](#entityscope-inventory) serves.
|
|
4157
|
+
|
|
4158
|
+
<a id="playerscope-passes"></a>
|
|
4159
|
+
|
|
4160
|
+
## PlayerScope.passes
|
|
4161
|
+
|
|
4162
|
+
```ts
|
|
4163
|
+
readonly passes: PassesApi
|
|
4164
|
+
```
|
|
4165
|
+
|
|
4166
|
+
Which store passes the player holds, of those the platform lets games see.
|
|
4167
|
+
For drawing a door; your function or server decides what a pass unlocks.
|
|
4168
|
+
|
|
4169
|
+
**Guides.** [arcade-and-store](../arcade-and-store.md)
|
|
4170
|
+
|
|
3926
4171
|
<a id="setting"></a>
|
|
3927
4172
|
|
|
3928
4173
|
## Setting
|
|
@@ -8243,7 +8488,7 @@ cover. Prefer the named surfaces; this one takes a path and checks nothing.
|
|
|
8243
8488
|
## GemFunction.me
|
|
8244
8489
|
|
|
8245
8490
|
```ts
|
|
8246
|
-
readonly me:
|
|
8491
|
+
readonly me: PlayerScope
|
|
8247
8492
|
```
|
|
8248
8493
|
|
|
8249
8494
|
The invoking player's data in your game — settings, inventory, currencies,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# The browser surface — API reference
|
|
2
2
|
|
|
3
|
-
Generated from `@indiegems/gem-web-sdk/sdk`
|
|
3
|
+
Generated from `@indiegems/gem-web-sdk/sdk` v19.0.1, the version of the package this file ships in. Every symbol below carries an explicit anchor, its `anchor` in `reference.json` beside this file.
|
|
4
4
|
|
|
5
5
|
`@indiegems/gem-web-sdk/sdk` is the one import a game writes, wherever its code runs. `@indiegems/gem-web-sdk/game` exports exactly the symbols on this page and nothing else, for a build that wants only this half.
|
|
6
6
|
|
|
@@ -2797,6 +2797,130 @@ readonly progressions: ProgressionsApi
|
|
|
2797
2797
|
Progressions this entity is working through — a projection over the same
|
|
2798
2798
|
cached snapshot [EntityScope.inventory](#entityscope-inventory) serves.
|
|
2799
2799
|
|
|
2800
|
+
<a id="playerscope"></a>
|
|
2801
|
+
|
|
2802
|
+
## PlayerScope
|
|
2803
|
+
|
|
2804
|
+
```ts
|
|
2805
|
+
interface PlayerScope
|
|
2806
|
+
```
|
|
2807
|
+
|
|
2808
|
+
What the signed-in player has in your game: everything a character has, and
|
|
2809
|
+
the store passes they hold. Reached as `gem.me`.
|
|
2810
|
+
|
|
2811
|
+
**Guides.** [saving-player-progress](../saving-player-progress.md)
|
|
2812
|
+
|
|
2813
|
+
<a id="playerscope-settings"></a>
|
|
2814
|
+
|
|
2815
|
+
## PlayerScope.settings
|
|
2816
|
+
|
|
2817
|
+
```ts
|
|
2818
|
+
readonly settings: SettingsApi
|
|
2819
|
+
```
|
|
2820
|
+
|
|
2821
|
+
Small named values your game chooses to persist — a difficulty, a control
|
|
2822
|
+
scheme, a last-used loadout.
|
|
2823
|
+
|
|
2824
|
+
Per key, so two settings written from two places do not overwrite each
|
|
2825
|
+
other. For a whole document of progress, use [EntityScope.saves](#entityscope-saves).
|
|
2826
|
+
|
|
2827
|
+
<a id="playerscope-inventory"></a>
|
|
2828
|
+
|
|
2829
|
+
## PlayerScope.inventory
|
|
2830
|
+
|
|
2831
|
+
```ts
|
|
2832
|
+
readonly inventory: InventoryApi
|
|
2833
|
+
```
|
|
2834
|
+
|
|
2835
|
+
What this player owns — items, and the progressions they are working
|
|
2836
|
+
through. Reads are cached; writes go through
|
|
2837
|
+
[EntityScope.mutations](#entityscope-mutations).
|
|
2838
|
+
|
|
2839
|
+
<a id="playerscope-currencies"></a>
|
|
2840
|
+
|
|
2841
|
+
## PlayerScope.currencies
|
|
2842
|
+
|
|
2843
|
+
```ts
|
|
2844
|
+
readonly currencies: CurrenciesApi
|
|
2845
|
+
```
|
|
2846
|
+
|
|
2847
|
+
Currency balances.
|
|
2848
|
+
|
|
2849
|
+
A currency the player holds none of is simply absent rather than present as
|
|
2850
|
+
zero, so read it as a lookup with a default rather than a list to iterate.
|
|
2851
|
+
|
|
2852
|
+
<a id="playerscope-mutations"></a>
|
|
2853
|
+
|
|
2854
|
+
## PlayerScope.mutations
|
|
2855
|
+
|
|
2856
|
+
```ts
|
|
2857
|
+
readonly mutations: MutationsApi
|
|
2858
|
+
```
|
|
2859
|
+
|
|
2860
|
+
Changing what this player has — spending currency, granting items, running
|
|
2861
|
+
a crafting recipe, advancing a progression.
|
|
2862
|
+
|
|
2863
|
+
Separate from [EntityScope.inventory](#entityscope-inventory) on purpose: reads are cached and
|
|
2864
|
+
safe to repeat, writes are neither, and one object holding both makes that
|
|
2865
|
+
distinction invisible where you call it.
|
|
2866
|
+
|
|
2867
|
+
<a id="playerscope-saves"></a>
|
|
2868
|
+
|
|
2869
|
+
## PlayerScope.saves
|
|
2870
|
+
|
|
2871
|
+
```ts
|
|
2872
|
+
readonly saves: SavesApi
|
|
2873
|
+
```
|
|
2874
|
+
|
|
2875
|
+
Saved progress — a world, a campaign, a replay. One document per key.
|
|
2876
|
+
|
|
2877
|
+
The line against [EntityScope.settings](#entityscope-settings) is what the value is, not how
|
|
2878
|
+
big it is: a setting is a value your game names, a save is an opaque
|
|
2879
|
+
document the platform stores and hands back. A chosen difficulty is a
|
|
2880
|
+
setting; the campaign it applies to is a save.
|
|
2881
|
+
|
|
2882
|
+
**Every save key must be declared in your game config first.** Writing to an
|
|
2883
|
+
undeclared key fails with a message naming it.
|
|
2884
|
+
|
|
2885
|
+
**Guides.** [saving-player-progress](../saving-player-progress.md)
|
|
2886
|
+
|
|
2887
|
+
<a id="playerscope-orders"></a>
|
|
2888
|
+
|
|
2889
|
+
## PlayerScope.orders
|
|
2890
|
+
|
|
2891
|
+
```ts
|
|
2892
|
+
readonly orders: OrdersApi
|
|
2893
|
+
```
|
|
2894
|
+
|
|
2895
|
+
This entity's order history — a read-only record of changes that happened.
|
|
2896
|
+
|
|
2897
|
+
Creating an order is [EntityScope.mutations](#entityscope-mutations); this answers "what
|
|
2898
|
+
happened" and "did my write land" (`orders.get(orderId)`).
|
|
2899
|
+
|
|
2900
|
+
<a id="playerscope-progressions"></a>
|
|
2901
|
+
|
|
2902
|
+
## PlayerScope.progressions
|
|
2903
|
+
|
|
2904
|
+
```ts
|
|
2905
|
+
readonly progressions: ProgressionsApi
|
|
2906
|
+
```
|
|
2907
|
+
|
|
2908
|
+
Progressions this entity is working through — a projection over the same
|
|
2909
|
+
cached snapshot [EntityScope.inventory](#entityscope-inventory) serves.
|
|
2910
|
+
|
|
2911
|
+
<a id="playerscope-passes"></a>
|
|
2912
|
+
|
|
2913
|
+
## PlayerScope.passes
|
|
2914
|
+
|
|
2915
|
+
```ts
|
|
2916
|
+
readonly passes: PassesApi
|
|
2917
|
+
```
|
|
2918
|
+
|
|
2919
|
+
Which store passes the player holds, of those the platform lets games see.
|
|
2920
|
+
For drawing a door; your function or server decides what a pass unlocks.
|
|
2921
|
+
|
|
2922
|
+
**Guides.** [arcade-and-store](../arcade-and-store.md)
|
|
2923
|
+
|
|
2800
2924
|
<a id="setting"></a>
|
|
2801
2925
|
|
|
2802
2926
|
## Setting
|
|
@@ -6898,6 +7022,127 @@ readonly isOpen: boolean
|
|
|
6898
7022
|
|
|
6899
7023
|
Whether the panel is on screen right now.
|
|
6900
7024
|
|
|
7025
|
+
<a id="gamepass"></a>
|
|
7026
|
+
|
|
7027
|
+
## GamePass
|
|
7028
|
+
|
|
7029
|
+
```ts
|
|
7030
|
+
interface GamePass
|
|
7031
|
+
```
|
|
7032
|
+
|
|
7033
|
+
One pass games may see, and whether this player holds it. Listed whether they
|
|
7034
|
+
hold it or not, and this is everything a game learns about it.
|
|
7035
|
+
|
|
7036
|
+
<a id="gamepass-pass"></a>
|
|
7037
|
+
|
|
7038
|
+
## GamePass.pass
|
|
7039
|
+
|
|
7040
|
+
```ts
|
|
7041
|
+
readonly pass: string
|
|
7042
|
+
```
|
|
7043
|
+
|
|
7044
|
+
The pass's offering slug, such as `vip`. Stable and not localized: key on this.
|
|
7045
|
+
|
|
7046
|
+
<a id="gamepass-held"></a>
|
|
7047
|
+
|
|
7048
|
+
## GamePass.held
|
|
7049
|
+
|
|
7050
|
+
```ts
|
|
7051
|
+
readonly held: boolean
|
|
7052
|
+
```
|
|
7053
|
+
|
|
7054
|
+
Whether the player holds it right now.
|
|
7055
|
+
|
|
7056
|
+
<a id="gamepass-endsat"></a>
|
|
7057
|
+
|
|
7058
|
+
## GamePass.endsAt
|
|
7059
|
+
|
|
7060
|
+
```ts
|
|
7061
|
+
readonly endsAt: string | null
|
|
7062
|
+
```
|
|
7063
|
+
|
|
7064
|
+
When the player stops holding it, RFC 3339 in UTC, grace and any queued
|
|
7065
|
+
period included. `null` when it is not held, and when it is held with no
|
|
7066
|
+
end, so read [GamePass.held](#gamepass-held) first: `null` alone never means ended.
|
|
7067
|
+
|
|
7068
|
+
<a id="passesevent"></a>
|
|
7069
|
+
|
|
7070
|
+
## PassesEvent
|
|
7071
|
+
|
|
7072
|
+
```ts
|
|
7073
|
+
type PassesEvent = "changed"
|
|
7074
|
+
```
|
|
7075
|
+
|
|
7076
|
+
The events [PassesApi.on](#passesapi-on) emits.
|
|
7077
|
+
|
|
7078
|
+
<a id="passesapi"></a>
|
|
7079
|
+
|
|
7080
|
+
## PassesApi
|
|
7081
|
+
|
|
7082
|
+
```ts
|
|
7083
|
+
interface PassesApi
|
|
7084
|
+
```
|
|
7085
|
+
|
|
7086
|
+
Which store passes the player holds, for the passes the platform lets games
|
|
7087
|
+
see. Reached as `gem.me.passes`. VIP is the pass `vip`.
|
|
7088
|
+
|
|
7089
|
+
Use it to DRAW a door open or shut, never to decide: it runs in the player's
|
|
7090
|
+
browser. What a pass unlocks is decided by your function or server.
|
|
7091
|
+
|
|
7092
|
+
Reads reject with a `GemApiError`, as every `gem.me` read does. That is
|
|
7093
|
+
unknown, not "not held", so keep what you drew. A guest reads as not holding.
|
|
7094
|
+
|
|
7095
|
+
**Guides.** [arcade-and-store](../arcade-and-store.md)
|
|
7096
|
+
|
|
7097
|
+
<a id="passesapi-list"></a>
|
|
7098
|
+
|
|
7099
|
+
## PassesApi.list
|
|
7100
|
+
|
|
7101
|
+
```ts
|
|
7102
|
+
list(): Promise<readonly GamePass[]>
|
|
7103
|
+
```
|
|
7104
|
+
|
|
7105
|
+
Every pass games may see, held or not, ordered by slug. Empty when the
|
|
7106
|
+
platform marks none. Always a fresh read; callers at the same moment share
|
|
7107
|
+
one request.
|
|
7108
|
+
|
|
7109
|
+
<a id="passesapi-get"></a>
|
|
7110
|
+
|
|
7111
|
+
## PassesApi.get
|
|
7112
|
+
|
|
7113
|
+
```ts
|
|
7114
|
+
get(pass: string): Promise<GamePass>
|
|
7115
|
+
```
|
|
7116
|
+
|
|
7117
|
+
One pass by its slug. A pass the platform does not list reads as not held,
|
|
7118
|
+
so a door for a pass that is not on sale yet simply stays shut.
|
|
7119
|
+
|
|
7120
|
+
| Parameter | Type |
|
|
7121
|
+
| --- | --- |
|
|
7122
|
+
| `pass` | `string` |
|
|
7123
|
+
|
|
7124
|
+
<a id="passesapi-on"></a>
|
|
7125
|
+
|
|
7126
|
+
## PassesApi.on
|
|
7127
|
+
|
|
7128
|
+
```ts
|
|
7129
|
+
on(event: "changed", listener: (passes: readonly GamePass[]) => void): () => void
|
|
7130
|
+
```
|
|
7131
|
+
|
|
7132
|
+
Hear the list change, with the new list, so a door opens right after a
|
|
7133
|
+
purchase and locks again when the pass ends. Returns a function that stops
|
|
7134
|
+
listening.
|
|
7135
|
+
|
|
7136
|
+
While something listens, the SDK reads again after a `gem.store` purchase
|
|
7137
|
+
answers, when one settles, on resume (so a purchase in the Arcade's own
|
|
7138
|
+
store is heard), after a sign-in and when a held pass ends. It says
|
|
7139
|
+
something only if the answer differs. Never fires in a function.
|
|
7140
|
+
|
|
7141
|
+
| Parameter | Type |
|
|
7142
|
+
| --- | --- |
|
|
7143
|
+
| `event` | `"changed"` |
|
|
7144
|
+
| `listener` | `(passes: readonly GamePass[]) => void` |
|
|
7145
|
+
|
|
6901
7146
|
<a id="rewardcue"></a>
|
|
6902
7147
|
|
|
6903
7148
|
## RewardCue
|
|
@@ -9641,6 +9886,11 @@ them when the arcade unmutes. You write nothing for it.
|
|
|
9641
9886
|
**Create your audio after `createGem`.** A graph connected to the speakers
|
|
9642
9887
|
before this call is out of the SDK's reach.
|
|
9643
9888
|
|
|
9889
|
+
It also brings your sound back after iOS cuts it off — the player leaving
|
|
9890
|
+
the app and returning: on their next tap in your frame, it resumes your
|
|
9891
|
+
`AudioContext`s and replays the media elements that were playing, leaving
|
|
9892
|
+
alone any you suspended or paused yourself.
|
|
9893
|
+
|
|
9644
9894
|
Turn it off only if you silence yourself in `onPrefs` — to fade your music
|
|
9645
9895
|
rather than cut it, say. The arcade shows its mute button for your game
|
|
9646
9896
|
either way where it shows one, so `false` is a promise that your handler goes quiet on
|
|
@@ -11080,7 +11330,7 @@ they are, and from [Gem.me](#gem-me), which is their data in your game.
|
|
|
11080
11330
|
## Gem.me
|
|
11081
11331
|
|
|
11082
11332
|
```ts
|
|
11083
|
-
readonly me:
|
|
11333
|
+
readonly me: PlayerScope
|
|
11084
11334
|
```
|
|
11085
11335
|
|
|
11086
11336
|
This player's data in your game — settings, inventory, currencies and
|
|
@@ -11334,7 +11584,8 @@ List what the store sells here with `offers()`, show each `priceDisplay`
|
|
|
11334
11584
|
exactly as given, and call `purchase(skuId)` from the player's press. For a
|
|
11335
11585
|
pass, a bundle or anything else whose pitch you would have to hardcode, call
|
|
11336
11586
|
`showOffer(skuId)` instead, and the arcade draws the offer. After `ok`,
|
|
11337
|
-
re-read balances through [Gem.me](#gem-me).
|
|
11587
|
+
re-read balances through [Gem.me](#gem-me), and `gem.me.passes` for a pass.
|
|
11588
|
+
Nothing rejects.
|
|
11338
11589
|
|
|
11339
11590
|
**Guides.** [arcade-and-store](../arcade-and-store.md)
|
|
11340
11591
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# The server surface — API reference
|
|
2
2
|
|
|
3
|
-
Generated from `@indiegems/gem-web-sdk/sdk`
|
|
3
|
+
Generated from `@indiegems/gem-web-sdk/sdk` v19.0.1, the version of the package this file ships in. Every symbol below carries an explicit anchor, its `anchor` in `reference.json` beside this file.
|
|
4
4
|
|
|
5
5
|
`@indiegems/gem-web-sdk/sdk` is the one import a game writes, wherever its code runs. `@indiegems/gem-web-sdk/server` exports exactly the symbols on this page and nothing else, for a build that wants only this half.
|
|
6
6
|
|