Module Brr_io.StorageSource

Storage objects.

See Web Storage API

Sourcetype t

The type for Storage objects.

Sourceval local : Brr.Window.t -> t

local w is the storage saved accross page sessions for the window's origin.

Sourceval session : Brr.Window.t -> t

session w is the storage cleared when the page session ends for the window's origin.

Sourceval length : t -> int

length s is the number of items in s.

Sourceval key : t -> int -> Jstr.t option

key s i is the name of the ith key. (N.B. local storage can race with other tabs)

Sourceval get_item : t -> Jstr.t -> Jstr.t option

get_item s k is the value of k in s.

Sourceval set_item : t -> Jstr.t -> Jstr.t -> (unit, Jv.Error.t) result

set_item s k v sets the value of k to v in s. An error is returned if the value could not be set (no permission or quota exceeded).

Sourceval remove_item : t -> Jstr.t -> unit

remove_item s k removes the value of k from s. If k has no value this does nothing.

Sourceval clear : t -> unit

clear s removes all keys from s.

Events

Sourcemodule Ev : sig ... end

Storage event.