Skip to main content

Function: loadRenderingChoice()

loadRenderingChoice(name?, storage?): "cpu" | "gpu" | undefined

Defined in: src/lib/storage/index.ts:463

The rendering (cpu or gpu) last chosen with the app settings of a name, kept in localStorage so it can be read before the canvas is made (the app settings themselves load later, from IndexedDB). Undefined when none was kept, it isn't valid, or the storage can't be read (e.g. blocked by the browser).

Parameters​

name?​

string = DEFAULT_SETTINGS_NAME

storage?​

Pick<Storage, "getItem"> | undefined = globalThis.localStorage

Returns​

"cpu" | "gpu" | undefined

Example​

new PaintCanvas({ rendering: loadRenderingChoice("demo") });