3.2.0 • Published 4 years ago
@tomnicolosi/storage-wrap v3.2.0
storage-wrap
A thin wrapper for the Web Storage API.
Uses code from MDN to check for storage availability prior to running storage methods (Reference).
Basic usage:
Installation via npm:
npm i @tomnicolosi/storage-wrap
Usage in JavaScript file:
import StorageWrap from "@tomnicolosi/storage-wrap;
// Store a 'test-value' equal to 'hello' in localStorage.
function store_test () {
StorageWrap.storage_write("test-value", "hello");
}
store_test();
// Read the value
function store_read () {
return StorageWrap.storage_read("test-value");
}
console.log(store_read); // "hello"