Web storage
It provides access to browser data storages (sessionStorage
and localStorage
)
To access session storage:
contexts.webStorage.session
To access local storage:
contexts.webStorage.local
These variables contain methods similar to those of the window.localStorage
and window.sessionStorage
objects.
clear() => void
getItem(key: string) => string
key(index: number) => string
// length (size) of the local / session storage
length => number
removeItem(key: string) => void
setItem(key: string, value: string) => void
You can save and access storage fields directly by referring to them by name and assigning values.
Example
const getExpression = () => {
contexts.webStorage.local.setItem('author', 'Shesha'); // write