Copyright | (C) 2016-2018 David M. Johnson |
---|---|
License | BSD3-style (see the file LICENSE) |
Maintainer | David M. Johnson <djohnson.m@gmail.com> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
This module provides an interface to the Web Storage API.
Synopsis
- getLocalStorage :: FromJSON model => MisoString -> JSM (Either String model)
- getSessionStorage :: FromJSON model => MisoString -> JSM (Either String model)
- setLocalStorage :: ToJSON model => MisoString -> model -> JSM ()
- setSessionStorage :: ToJSON model => MisoString -> model -> JSM ()
- removeLocalStorage :: MisoString -> JSM ()
- removeSessionStorage :: MisoString -> JSM ()
- clearLocalStorage :: JSM ()
- clearSessionStorage :: JSM ()
- localStorageLength :: JSM Int
- sessionStorageLength :: JSM Int
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