Read a value from sessionStorage, parsing JSON when possible.
sessionStorage
Usage:
import { setSessionJSON, getSessionJSON } from "mazey";setSessionJSON("preferences", { theme: "dark" });const preferences = getSessionJSON("preferences");console.log(JSON.stringify(preferences)); Copy
import { setSessionJSON, getSessionJSON } from "mazey";setSessionJSON("preferences", { theme: "dark" });const preferences = getSessionJSON("preferences");console.log(JSON.stringify(preferences));
Output:
{"theme":"dark"} Copy
{"theme":"dark"}
Storage key.
The parsed value, raw stored value, or null when no value exists.
null
Read a value from
sessionStorage, parsing JSON when possible.Usage:
Output: