日本語
@eightkk/vue-weave / core / SnapshotCodec
Interface: SnapshotCodec<T>
Defined in: src/core/snapshot.ts:45
Stores values that JSON cannot represent (Date, BigInt, Map...) in application data. The stored form is { "$codec": id, "version": n, "value": ... }. Serializing needs matches and encode; restoring needs decode.
Type Parameters
T
T = any
Properties
decode?
optionaldecode?: (value,version) =>T
Defined in: src/core/snapshot.ts:51
Parameters
value
version
number
Returns
T
encode?
optionalencode?: (value) =>JsonValue
Defined in: src/core/snapshot.ts:50
Parameters
value
T
Returns
id
id:
string
Defined in: src/core/snapshot.ts:46
matches?
optionalmatches?: (value) =>boolean
Defined in: src/core/snapshot.ts:49
Parameters
value
unknown
Returns
boolean
version?
optionalversion?:number
Defined in: src/core/snapshot.ts:48
Version written with each value, passed to decode on restore. Defaults to 1.