Module
Web.Storage.Storage
- Package
- purescript-web-storage
- Repository
- purescript-web/purescript-web-storage
This module defines a data type and various functions for interacting
with the Storage
interface of the Web Storage API.
For example:
import Prelude
import Effect (Effect)
import Effect.Console (log, logShow)
import Web.HTML (window)
import Web.HTML.Window (localStorage)
import Web.Storage.Storage (clear, getItem, removeItem, setItem)
main :: Effect Unit
main = do
w <- window
s <- localStorage w
setItem "this-is-my-key" "Here is my value." s
v <- getItem "this-is-my-key" s
logShow v
removeItem "this-is-my-key" s
v' <- getItem "this-is-my-key" s
log "It is gone!"
logShow v'
clear s