LocalForageTest (#550)

This commit is contained in:
Václav Klecanda 2018-01-04 17:33:18 +01:00 committed by Shawn Erquhart
parent e45f531319
commit b927c8acfb
2 changed files with 19 additions and 1 deletions

View File

@ -1,4 +1,4 @@
import LocalForage from "localforage";
import LocalForage from "Lib/LocalForage";
import { Base64 } from "js-base64";
import { uniq, initial, last, get, find } from "lodash";
import { filterPromises, resolvePromiseProperties } from "Lib/promiseHelper";

18
src/lib/LocalForage.js Normal file
View File

@ -0,0 +1,18 @@
import LocalForage from "localforage";
function LocalForageTest() {
const testKey = 'LocalForageTest';
LocalForage.setItem(testKey, {expires: Date.now() + 300000}).then(() => {
LocalForage.removeItem(testKey);
}).catch((err) => {
if (err.code === 22) {
const message = `Uable to set localStorage key. Quota exceeded! Full disk?`;
return alert(`${message}\n\n${err}`);
}
console.log(err);
})
}
LocalForageTest();
export default LocalForage;