| Copyright | (C) 2016-2025 David M. Johnson |
|---|---|
| License | BSD3-style (see the file LICENSE) |
| Maintainer | David M. Johnson <code@dmj.io> |
| Stability | experimental |
| Portability | non-portable |
| Safe Haskell | None |
| Language | Haskell2010 |
Miso.Storage
Description
This module provides an interface to the Web Storage API.
Synopsis
- getLocalStorage :: FromJSON model => MisoString -> JSM (Either String model)
- setLocalStorage :: ToJSON model => MisoString -> model -> JSM ()
- removeLocalStorage :: MisoString -> JSM ()
- clearLocalStorage :: JSM ()
- localStorageLength :: JSM Int
- getSessionStorage :: FromJSON model => MisoString -> JSM (Either String model)
- setSessionStorage :: ToJSON model => MisoString -> model -> JSM ()
- removeSessionStorage :: MisoString -> JSM ()
- clearSessionStorage :: JSM ()
- sessionStorageLength :: JSM Int
Local
getLocalStorage :: FromJSON model => MisoString -> JSM (Either String model) Source #
Retrieve a value stored under given key in local 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.
removeLocalStorage :: MisoString -> JSM () Source #
Removes an item from local storage
removeLocalStorage key removes the value of key.
clearLocalStorage :: JSM () Source #
Clear local storage
clearLocalStorage removes all values from local storage.
localStorageLength :: JSM Int Source #
Local storage length
localStorageLength returns the count of items in local storage
Session
getSessionStorage :: FromJSON model => MisoString -> JSM (Either String model) Source #
Retrieve a value stored under given key in session storage
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.
removeSessionStorage :: MisoString -> JSM () Source #
Removes an item from session storage.
removeSessionStorage key removes the value of key.
clearSessionStorage :: JSM () Source #
Clear session storage
clearSessionStorage removes all values from session storage.
sessionStorageLength :: JSM Int Source #
Session storage length
sessionStorageLength returns the count of items in session storage