2018-08-07 14:46:54 -06:00
|
|
|
import localForage from 'localforage';
|
2018-07-03 15:47:15 -04:00
|
|
|
|
|
|
|
function localForageTest() {
|
|
|
|
const testKey = 'localForageTest';
|
2018-08-07 14:46:54 -06:00
|
|
|
localForage
|
|
|
|
.setItem(testKey, { expires: Date.now() + 300000 })
|
|
|
|
.then(() => {
|
|
|
|
localForage.removeItem(testKey);
|
|
|
|
})
|
|
|
|
.catch(err => {
|
|
|
|
if (err.code === 22) {
|
|
|
|
const message = `Unable to set localStorage key. Quota exceeded! Full disk?`;
|
|
|
|
return alert(`${message}\n\n${err}`);
|
|
|
|
}
|
|
|
|
console.log(err);
|
|
|
|
});
|
2018-07-03 15:47:15 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
localForageTest();
|
|
|
|
|
|
|
|
export default localForage;
|