API / Dom / Storage2

You are currently looking at the < v8.2.0 docs (Reason v3.6 syntax edition). You can find the latest API docs here.

(These docs cover all versions between v3 to v8 and are equivalent to the old BuckleScript docs before the rebrand)

Storage2

The same as Dom.Storage, but with t on first argument position for proper -> usage.

t

type t

getItem

external getItem: (t, string) => option(string) = "getItem"

setItem

external setItem: (t, string, string) => unit = "setItem"

removeItem

external removeItem: (t, string) => unit = "removeItem"

clear

external clear: t => unit = "clear"

key

external key: (t, int) => option(string) = "key"

length

external length: t => int = "length"

localStorage

[@bs.val] external localStorage: t = "localStorage"

sessionStorage

[@bs.val] external sessionStorage: t = "sessionStorage"