@arcadible/sdk 1.2.1 → 1.2.2

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/README.md CHANGED
@@ -27,34 +27,31 @@ Each build of a game on [Arcadible](https://arcadible.com) has its own origin, s
27
27
  npm install @arcadible/sdk
28
28
  ```
29
29
 
30
- Use the package in a game with a build step, such as a Vite project. A game without one includes the hosted script instead, which Arcadible serves from every build's own origin, as `arc serve` does locally:
31
-
32
- ```html
33
- <script src="/arcadible/sdk/v1.js"></script>
34
- ```
30
+ The package is for a game with a build step, such as a Vite project. A game without one uses the [hosted script](https://developer.arcadible.com/references/arcadible-sdk#install) instead.
35
31
 
36
32
  ## Save and load
37
33
 
38
34
  ```js
39
35
  import { arcadible } from "@arcadible/sdk";
40
36
 
37
+ // at startup: once the saves have loaded, the player's progress, or a new game.
41
38
  await arcadible.ready;
42
-
43
- const saved = arcadible.saves.readSync("progress");
39
+ const saved = await arcadible.saves.read("progress");
44
40
  const progress = saved ? JSON.parse(saved) : { level: 1 };
45
41
 
42
+ // at a checkpoint:
46
43
  await arcadible.saves.write("progress", JSON.stringify(progress));
47
44
  ```
48
45
 
49
- A save is a name holding one string. `ready` settles once the game's saves have loaded, and never fails; from then on, `readSync`, `listSync`, and `infoSync` answer from memory. Every call that fails rejects (or, for the sync calls, throws) with an `ArcadibleError`, whose `code` says what to do. `arcadible.saves.where` says who can read the saves back: every version of the game, only this build, or only until the page closes.
46
+ A save is a name holding one string. `arcadible.ready` settles once the game's saves have loaded, and never fails; calls made before it wait for it, and from then on `readSync`, `listSync`, and `infoSync` answer at once from memory, for reads during play. Every call that fails rejects (or, for the sync calls, throws) with an `ArcadibleError`, whose `code` says what to do. `arcadible.saves.where` says who can read the saves back: every version of the game, only this build, or only until the page closes.
50
47
 
51
48
  Off Arcadible, such as on your dev server, the package works on its own, with the same rules and limits: saves are kept on the page's own origin, `arcadible.saves.where` is `"build"`, and `arcadible.build` is `null`.
52
49
 
53
50
  ## Learn more
54
51
 
55
- - [Saves](https://developer.arcadible.com/build/saves): adding the SDK, what to save, and other versions' saves.
52
+ - [Arcadible SDK](https://developer.arcadible.com/references/arcadible-sdk): installing it, the hosted script, `ready` and `build`, and every code.
56
53
  - [`arcadible.saves`](https://developer.arcadible.com/references/arcadible-sdk/saves): every call, what it returns, and when it fails.
57
- - [Arcadible SDK](https://developer.arcadible.com/references/arcadible-sdk): `ready` and `build`, and every code.
54
+ - [Saves](https://developer.arcadible.com/build/saves): using saves well, across versions, channels, and tabs, and where they're kept.
58
55
  - [Limits](https://developer.arcadible.com/references/limits#saves): how many saves, and how large.
59
56
 
60
57
  ## License
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "1.2.1";
1
+ export declare const VERSION = "1.2.2";
package/dist/version.js CHANGED
@@ -1,3 +1,3 @@
1
1
  // The client's version, sent in its hello and shown as `arcadible.version`,
2
2
  // for bug reports. It matches package.json (test/unit/protocol.test.ts).
3
- export const VERSION = "1.2.1";
3
+ export const VERSION = "1.2.2";
package/package.json CHANGED
@@ -43,5 +43,5 @@
43
43
  ],
44
44
  "type": "module",
45
45
  "types": "./dist/index.d.ts",
46
- "version": "1.2.1"
46
+ "version": "1.2.2"
47
47
  }