LocalForageTest (#550)
This commit is contained in:
parent
e45f531319
commit
b927c8acfb
@ -1,4 +1,4 @@
|
|||||||
import LocalForage from "localforage";
|
import LocalForage from "Lib/LocalForage";
|
||||||
import { Base64 } from "js-base64";
|
import { Base64 } from "js-base64";
|
||||||
import { uniq, initial, last, get, find } from "lodash";
|
import { uniq, initial, last, get, find } from "lodash";
|
||||||
import { filterPromises, resolvePromiseProperties } from "Lib/promiseHelper";
|
import { filterPromises, resolvePromiseProperties } from "Lib/promiseHelper";
|
||||||
|
18
src/lib/LocalForage.js
Normal file
18
src/lib/LocalForage.js
Normal 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;
|
Loading…
x
Reference in New Issue
Block a user