Skip to main content

Class: MemoryDocumentStore

Defined in: src/testing/documentStore.ts:18

A document store kept in memory (e.g. for tests, or to try out remote saving), recording each save.

Example​

canvas.useRemoteDocumentStore(new MemoryDocumentStore({ label: "Test", delayMs: 2000 }));

Implements​

Constructors​

Constructor​

new MemoryDocumentStore(__namedParameters?): MemoryDocumentStore

Defined in: src/testing/documentStore.ts:29

Parameters​

__namedParameters?​

MemoryDocumentStoreOptions = {}

Returns​

MemoryDocumentStore

Properties​

documents​

readonly documents: Map<string, DrawingDocument>

Defined in: src/testing/documentStore.ts:22

The saved documents, by ID


label?​

readonly optional label?: string

Defined in: src/testing/documentStore.ts:19

Names the store for the user, e.g. "Bluesky" (shown while saving)

Implementation of​

DocumentStoreLike.label


saves​

readonly saves: DrawingDocument[] = []

Defined in: src/testing/documentStore.ts:25

Each save, in order

Methods​

load()​

load(id): Promise<DrawingDocument | undefined>

Defined in: src/testing/documentStore.ts:47

A saved document by ID, or undefined if there's none

Parameters​

id​

string

Returns​

Promise<DrawingDocument | undefined>

Implementation of​

DocumentStoreLike.load


save()​

save(document, onProgress?): Promise<void>

Defined in: src/testing/documentStore.ts:34

Save a document, replacing the one with the same ID. Call onProgress with how much is done (0 to 1), if known.

Parameters​

document​

DrawingDocument

onProgress?​

(done) => void

Returns​

Promise<void>

Implementation of​

DocumentStoreLike.save