Core · class

BrowserStore

localStorage, with every access guarded.

Explained in The loop.

class BrowserStore implements KeyValueStore
import { BrowserStore } from '@driftengine/core';

In depth

A blocked store degrades to memory rather than to nothing: settings then last the session instead of resetting between screens, and a first-run prompt fires once per visit instead of on every single load. Never showing it at all would be the worse failure — a player who arrived from a link would have no idea what the controls are.

Constructor

new

constructor()

Methods

read

read(key: string): string | null
ParameterTypeDescription
keystring

write

write(key: string, value: string): void
ParameterTypeDescription
keystring
valuestring

remove

remove(key: string): void
ParameterTypeDescription
keystring