miso-1.8.1.0: A tasty Haskell front-end framework
Copyright(C) 2016-2018 David M. Johnson
LicenseBSD3-style (see the file LICENSE)
MaintainerDavid M. Johnson <djohnson.m@gmail.com>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Miso.Effect.Storage

Description

This module provides an interface to the Web Storage API.

Synopsis

Retrieve storage

getLocalStorage :: FromJSON model => MisoString -> JSM (Either String model) Source #

Retrieve a value stored under given key in local storage

getSessionStorage :: FromJSON model => MisoString -> JSM (Either String model) Source #

Retrieve a value stored under given key in session storage

Set items in storage

setLocalStorage :: ToJSON model => MisoString -> model -> JSM () Source #

Set the value of a key in local storage.

setLocalStorage key value sets the value of key to value.

setSessionStorage :: ToJSON model => MisoString -> model -> JSM () Source #

Set the value of a key in session storage.

setSessionStorage key value sets the value of key to value.

Remove items from storage

removeLocalStorage :: MisoString -> JSM () Source #

Removes an item from local storage

removeLocalStorage key removes the value of key.

removeSessionStorage :: MisoString -> JSM () Source #

Removes an item from session storage.

removeSessionStorage key removes the value of key.

Clear storage

clearLocalStorage :: JSM () Source #

Clear local storage

clearLocalStorage removes all values from local storage.

clearSessionStorage :: JSM () Source #

Clear session storage

clearSessionStorage removes all values from session storage.

Get number of items in storage

localStorageLength :: JSM Int Source #

Local storage length

localStorageLength returns the count of items in local storage

sessionStorageLength :: JSM Int Source #

Session storage length

sessionStorageLength returns the count of items in session storage