check-storage
v1.0.2
Published
Aims at (naïvely) exporting a consistent API between Web Extensions and localStorage
Downloads
2
Readme
check-storage
This is a tiny module that tries to figure out what storage adaptor it should use, sorting between localStorage and chrome.storage.sync (the equivalent WebExtension API).
Usage
import { storage } from 'check-storage';
console.log(storage.type);
try {
storage.add(key, value);
storage.get(key);
storage.remove(key);
} catch {
console.log('storage not initialised. Maybe the env has neither API?')
}