Skip to content

Commit

Permalink
LocalForageTest (#550)
Browse files Browse the repository at this point in the history
  • Loading branch information
vencax authored and erquhart committed Jan 4, 2018
1 parent e45f531 commit b927c8a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/backends/github/API.js
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
18 changes: 18 additions & 0 deletions src/lib/LocalForage.js
Original file line number Diff line number Diff line change
@@ -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;

0 comments on commit b927c8a

Please sign in to comment.