mazey
    Preparing search index...

    Variable setLocalStorageConst

    setLocalStorage: <T>(key: string, value?: T | null) => void = setLocalJSON

    Deprecated alias of setLocalJSON.

    Type Declaration

      • <T>(key: string, value?: T | null): void
      • Serialize a value as JSON and store it in localStorage.

        Usage:

        import { setLocalJSON, getLocalJSON } from "mazey";

        setLocalJSON("preferences", { theme: "dark" });
        const preferences = getLocalJSON("preferences");
        console.log(JSON.stringify(preferences));

        Output:

        {"theme":"dark"}
        

        Type Parameters

        • T

        Parameters

        • key: string

          Storage key.

        • value: T | null = null

          Value to serialize and store.

        Returns void

        This function does not return a value.

    Use setLocalJSON instead.