Reference · Rolls and exact odds
StorageLiketype
The storage a browser offers, or anything shaped like it.
Import it
import type { StorageLike } from "@johnmorrisdotca/korokoro";
Definition
type StorageLike = Pick<Storage, "getItem" | "setItem" | "removeItem">;
Members
| Name | Type | Description |
|---|---|---|
getItem | (key: string) => string | null | The |
setItem | (key: string, value: string) => void | The |
removeItem | (key: string) => void | The |
Examples
import type { StorageLike } from "@johnmorrisdotca/korokoro";
const value: StorageLike = { getItem: () => null, setItem: () => {}, removeItem: () => {} };
console.log(value.getItem("history"));nullWhat it prints (run when this page was built)