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) {
|
2018-08-28 14:48:10 -07:00
|
|
|
const message = 'Unable to set localStorage key. Quota exceeded! Full disk?';
|
|
|
|
console.warn(message);
|
2018-08-07 14:46:54 -06:00
|
|
|
}
|
|
|
|
console.log(err);
|
|
|
|
});
|
2018-07-03 15:47:15 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
localForageTest();
|
|
|
|
|
|
|
|
export default localForage;
|