Skip to content

Commit

Permalink
Fix no-cache bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
CMEONE committed Mar 10, 2021
1 parent f61ef85 commit 3be3ac5
Showing 1 changed file with 12 additions and 10 deletions.
22 changes: 12 additions & 10 deletions tApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class tApp {
static database;
static currentHash = "/";
static get version() {
return "v0.8.5";
return "v0.8.6";
}
static configure(params) {
if(params == null) {
Expand Down Expand Up @@ -55,7 +55,7 @@ class tApp {
error: "tAppError: Invalid configure parameter, caching is not of type Object."
}
}
if(params.caching.backgroundPages != null && !(params.caching.backgroundPages instanceof Array)) {
if(params.caching != null && params.caching.backgroundPages != null && !(params.caching.backgroundPages instanceof Array)) {
return {
valid: false,
error: "tAppError: Invalid configure parameter, caching.backgroundPages is not of type Array."
Expand Down Expand Up @@ -450,20 +450,22 @@ class tApp {
}
}
static loadBackgroundPages() {
for(let i = 0; i < tApp.config.caching.backgroundPages.length; i++) {
tApp.get(tApp.config.caching.backgroundPages[i]);
}
if(tApp.config.caching.periodicUpdate != null) {
setTimeout(() => {
tApp.loadBackgroundPages();
}, tApp.config.caching.periodicUpdate)
if(tApp.config.caching != null) {
for(let i = 0; i < tApp.config.caching.backgroundPages.length; i++) {
tApp.get(tApp.config.caching.backgroundPages[i]);
}
if(tApp.config.caching.periodicUpdate != null) {
setTimeout(() => {
tApp.loadBackgroundPages();
}, tApp.config.caching.periodicUpdate)
}
}
}
static start() {
return new Promise((resolve, reject) => {
if(!tApp.started) {
tApp.started = true;
if(tApp.config.caching.persistent) {
if(tApp.config.caching != null && tApp.config.caching.persistent) {
Object.defineProperty(window, 'indexedDB', {
value: window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB
});
Expand Down

0 comments on commit 3be3ac5

Please sign in to comment.