localstorage

package
v2.9.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 5, 2023 License: GPL-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrorLocalStorageUndefined errs.Error = "localStorage is undefined"
	ErrorKeyNotFound           errs.Error = "key not found"
)

Variables

This section is empty.

Functions

func Clear

func Clear() error

Clear all key value pairs from localStorage

func Get

func Get(key string) (string, error)

Get a value from localStorage

func Remove

func Remove(key string) error

Remove a key value pair from localStorage

func Set

func Set(key, value string) error

Set a key value pair in localStorage

func UnsafeGet

func UnsafeGet(key string, dst interface{}) error

Try to get any object by first getting the string from localStorage, then shell out to JSON.parse and scan the object into dst.

func UnsafeSet

func UnsafeSet(key, value interface{}) error

Try to set any object by first converting it to a js.Value, then converting it to a string, shelling out to JSON.stringify,

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL