1
0
mirror of https://github.com/chinchang/web-maker.git synced 2025-10-11 11:34:24 +02:00

add offline enabled build process

This commit is contained in:
Kushagra Gour
2017-11-08 01:04:59 +05:30
parent a230d6929f
commit 51aac2e63b
110 changed files with 166185 additions and 14 deletions

View File

@@ -1,8 +1,11 @@
(() => {
const FAUX_DELAY = 1;
var local = {
get: (obj, cb) => {
if (typeof obj === 'string') {
setTimeout(() => cb(window.localStorage.getItem(obj)), 100);
const retVal = {};
retVal[obj] = JSON.parse(window.localStorage.getItem(obj));
setTimeout(() => cb(retVal), FAUX_DELAY);
} else {
const retVal = {};
Object.keys(obj).forEach(key => {
@@ -10,14 +13,16 @@
retVal[key] =
val === undefined || val === null ? obj[key] : JSON.parse(val);
});
setTimeout(() => cb(retVal), 100);
setTimeout(() => cb(retVal), FAUX_DELAY);
}
},
set: (obj, cb) => {
Object.keys(obj).forEach(key => {
window.localStorage.setItem(key, JSON.stringify(obj[key]));
});
setTimeout(() => cb(), 100);
setTimeout(() => {
if (cb) cb();
}, FAUX_DELAY);
}
};
window.db = {