Constructor
new VersionedSaveEngine(optionsopt)
| Name | Type | Attributes | Description |
|---|---|---|---|
options | Object | <optional> |
- Source
Classes
Methods
diagnoseCorruptJson(rawText, syntaxErroropt) → {Object}
Diagnose a corrupt JSON string and produce line, column, snippet, and reason.
| Name | Type | Attributes | Description |
|---|---|---|---|
rawText | string | ||
syntaxError | Error | <optional> |
- Source
- Type:
- Object
has(slot) → {boolean}
Check if a save slot exists in storage.
| Name | Type | Description |
|---|---|---|
slot | string |
- Source
- Type:
- boolean
key(slot) → {string}
Build storage key for a save slot.
| Name | Type | Description |
|---|---|---|
slot | string |
- Source
- Type:
- string
load(slotOrRaw, optionsopt) → {Object|null}
Load, migrate, and validate save data from a slot or raw JSON text.
| Name | Type | Attributes | Description |
|---|---|---|---|
slotOrRaw | string | | ||
options | Object | <optional> |
- Source
- Type:
- Object |
null
migrate(record, targetVersionopt) → {Object}
Migrate a save record through sequential registered schema migrations. Enforces step verification and atomic abort on errors.
| Name | Type | Attributes | Description |
|---|---|---|---|
record | Object | ||
targetVersion | number | <optional> |
- Source
- Type:
- Object
recoverCorruptJson(rawText, optionsopt) → {Object}
Attempt recovery of corrupt JSON through heuristics and fallback backups.
| Name | Type | Attributes | Description |
|---|---|---|---|
rawText | string | ||
options | Object | <optional> |
- Source
- Type:
- Object
registerMigration(fromVersion, toVersionOrFn, maybeFnopt, optionsopt) → {VersionedSaveEngine}
Register a schema migration.
| Name | Type | Attributes | Description |
|---|---|---|---|
fromVersion | number | ||
toVersionOrFn | number | | ||
maybeFn | function | <optional> | |
options | Object | <optional> |
- Source
- Type:
- VersionedSaveEngine
remove(slot)
Remove a save slot and its backup from storage.
| Name | Type | Description |
|---|---|---|
slot | string |
- Source
save(slot, data, optionsopt) → {Object}
Save data into a named storage slot with backup and reference validation.
| Name | Type | Attributes | Description |
|---|---|---|---|
slot | string | ||
data | Object | ||
options | Object | <optional> |
- Source
- Type:
- Object
slots() → {Array.<string>}
List all save slots currently present in storage.
- Source
- Type:
- Array.<string>
validate(data, optionsopt) → {Object}
Validate references on entities and components.
| Name | Type | Attributes | Description |
|---|---|---|---|
data | Object | ||
options | Object | <optional> |
- Source
- Type:
- Object