@mocanvas/store · interface

SynchronousStorage

interface SynchronousStorage<R extends UnknownRecord = UnknownRecord> extends SynchronousRecordStorage<R>

Record storage that also remembers the schema its records were written against, so they can be migrated when they are read back.

Storing records without their schema is the one mistake that cannot be recovered from later: there is no way to tell which migrations have already run, and re-running them corrupts the data.


Methods · 2

getSchema(): SerializedSchema | undefined

The schema the stored records were written against, or undefined when empty.

setSchema(schema: SerializedSchema): void

Record the schema the stored records are written against.

mocanvas is built by Symbio. Free for non-commercial, non-profit and development use; commercial use needs an agreement. Not affiliated with or endorsed by tldraw.