Serialize a value as JSON and store it in localStorage.
localStorage
Usage:
import { setLocalJSON, getLocalJSON } from "mazey";setLocalJSON("preferences", { theme: "dark" });const preferences = getLocalJSON("preferences");console.log(JSON.stringify(preferences)); Copy
import { setLocalJSON, getLocalJSON } from "mazey";setLocalJSON("preferences", { theme: "dark" });const preferences = getLocalJSON("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
localStorage.Usage:
Output: