Serialize a value as JSON and store it in sessionStorage.
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.
Value to serialize and store.
This function does not return a value.
Serialize a value as JSON and store it in
sessionStorage.Usage:
Output: