miso-0.16.0.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

Contents

Description

This module provides an interface to the Web Storage API.

Synopsis

Retrieve storage

getLocalStorage :: FromJSON model => JSString -> IO (Either String model) Source

Retrieve local storage

getSessionStorage :: FromJSON model => JSString -> IO (Either String model) Source

Retrieve session storage

Set items in storage

setLocalStorage :: ToJSON model => JSString -> model -> IO () Source

Set the value of a key in local storage.

setLocalStorage key value sets the value of key to value.

setSessionStorage :: ToJSON model => JSString -> model -> IO () 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 :: JSString -> IO () Source

Removes item from local storage by key name.

removeSessionStorage :: JSString -> IO () Source

Removes item from session storage by key name.

Clear storage

clearLocalStorage :: IO () Source

Clears local storage.

clearSessionStorage :: IO () Source

Clears session storage.

Get number of items in storage

localStorageLength :: IO Int Source

Retrieves the number of items in local storage.

sessionStorageLength :: IO Int Source

Retrieves the number of items in session storage.