gbr/js/jsstorage
Bindings to local and session storage.
Types
A Storage object (local or session).
See https://developer.mozilla.org/en-US/docs/Web/API/Storage.
pub type Storage
Values
pub fn get_item(
storage: Storage,
key: String,
) -> Result(String, String)
Returns the item with the specified key, if it exists.
pub fn key(
storage: Storage,
index: Int,
) -> Result(String, String)
Returns the key of the item with the index index, if it exists.
pub fn local() -> Result(Storage, String)
Attempts to get the local storage object, fails if it’s not available.
pub fn remove_item(
storage: Storage,
key: String,
) -> Result(Nil, String)
Removes an item with the specified key.
pub fn session() -> Result(Storage, String)
Attempts to get the session storage object, fails if it’s not available.