Skip to main content

Interface: AutosaveOptions

Defined in: src/lib/classes/LayerAutosave/index.ts:60

Options for LayerAutosave

Properties​

decode?​

optional decode?: (image) => Promise<CanvasImageSource>

Defined in: src/lib/classes/LayerAutosave/index.ts:71

Turns a saved PNG into an image to draw (replaceable for tests)

Parameters​

image​

Blob

Returns​

Promise<CanvasImageSource>


delayMs?​

optional delayMs?: number

Defined in: src/lib/classes/LayerAutosave/index.ts:73

How long to wait after the layers change before saving (default SAVE_DELAY_MS)


document?​

optional document?: Pick<Document, "addEventListener" | "removeEventListener" | "visibilityState"> | null

Defined in: src/lib/classes/LayerAutosave/index.ts:64

Tells when the page is hidden or shown again (the page's document by default)


encode?​

optional encode?: (canvas) => Promise<Blob>

Defined in: src/lib/classes/LayerAutosave/index.ts:69

Turns a layer's canvas into a PNG (in a background worker by default; replaceable for tests)

Parameters​

canvas​

OffscreenCanvas

Returns​

Promise<Blob>


locks?​

optional locks?: LockManager | null

Defined in: src/lib/classes/LayerAutosave/index.ts:62

Makes sure only one window draws on a drawing (the browser's Web Locks by default; none to skip)