@arcadible/sdk 1.4.0 → 1.4.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/README.md CHANGED
@@ -54,7 +54,7 @@ const progress = saved ? JSON.parse(saved) : { level: 1 };
54
54
  await arcadible.saves.write("progress", JSON.stringify(progress));
55
55
  ```
56
56
 
57
- A save is a name holding one string. Once `initStart()` has resolved, `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.
57
+ A save is a name holding one string. Read your saves once as your game starts, keep the state in your game, and write at checkpoints. Every call returns a promise, and one that fails rejects 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.
58
58
 
59
59
  Off Arcadible, such as on your dev server, the package still works, with the same rules and limits: there's no loading screen, so `initComplete()` resolves at once, saves are kept in the game's own browser storage, `arcadible.saves.where` is `"build"`, and `arcadible.build` is `null`.
60
60
 
@@ -40,6 +40,7 @@ export const Codes = {
40
40
  Busy: "busy",
41
41
  Full: "full",
42
42
  Invalid: "invalid",
43
+ // only `readSync`, `listSync`, and `infoSync` throw it, before `ready`.
43
44
  NotReady: "not_ready",
44
45
  Timeout: "timeout",
45
46
  TooLarge: "too_large",
@@ -14,8 +14,7 @@ export const Names = {
14
14
  Complete: "lifecycle.initComplete",
15
15
  };
16
16
  // The first SDK that sends them. An older one doesn't, so the page takes its
17
- // loading screen down at `load`, without waiting to hear. 1.3's SDKs sent
18
- // these under other names, so the page treats them as older too.
17
+ // loading screen down at `load`, without waiting to hear.
19
18
  export const INIT_SINCE = "1.4.0";
20
19
  // How long `initComplete()` waits for the page to say the game is visible:
21
20
  // past the loading screen's minimum and fade, and a device held the wrong
@@ -12,17 +12,28 @@ export interface Saves {
12
12
  info(name: string): Promise<SaveInfo | null>;
13
13
  /** Removes the save, if there is one. */
14
14
  remove(name: string): Promise<void>;
15
- /** After `ready`, the save's string from memory; before it, throws `not_ready`. */
15
+ /**
16
+ * The save's string from memory, once `ready` has settled; before it,
17
+ * throws `not_ready`. Prefer `await read(name)`: read once as the game
18
+ * starts, and keep the state in the game.
19
+ */
16
20
  readSync(name: string): string | null;
17
- /** After `ready`, the names of the game's saves from memory, sorted. */
21
+ /**
22
+ * The names of the game's saves from memory, sorted, once `ready` has
23
+ * settled. Prefer `await list()`.
24
+ */
18
25
  listSync(): string[];
19
- /** After `ready`, the save's version and time from memory, or `null`. */
26
+ /**
27
+ * Which version wrote the save, and when, from memory, once `ready` has
28
+ * settled. Prefer `await info(name)`.
29
+ */
20
30
  infoSync(name: string): SaveInfo | null;
21
31
  /**
22
- * Who can read the saves back, once `ready` has settled: `"game"` (every
23
- * version of the game), `"build"` (only this build), or `"memory"` (only
24
- * until the page closes). `undefined` until it's known. Other values may
25
- * be added: treat one you don't know as `"game"`.
32
+ * Who can read the saves back, once `initStart()` or `ready` has
33
+ * settled: `"game"` (every version of the game), `"build"` (only this
34
+ * build), or `"memory"` (only until the page closes). `undefined` until
35
+ * it's known. Other values may be added: treat one you don't know as
36
+ * `"game"`.
26
37
  */
27
38
  readonly where: Where | undefined;
28
39
  }
package/dist/version.d.ts CHANGED
@@ -1 +1 @@
1
- export declare const VERSION = "1.4.0";
1
+ export declare const VERSION = "1.4.1";
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.4.0";
3
+ export const VERSION = "1.4.1";
package/package.json CHANGED
@@ -43,5 +43,5 @@
43
43
  ],
44
44
  "type": "module",
45
45
  "types": "./dist/index.d.ts",
46
- "version": "1.4.0"
46
+ "version": "1.4.1"
47
47
  }