Browse Source

#2534 - Add cacheType setting, response or html. Response caches original response so that execution occurs in same way each load. HTML caches final html content after callbacks

pull/4046/head
Jack Lukic 8 years ago
parent
commit
6b5c383dab
1 changed files with 7 additions and 1 deletions
  1. 8
      src/definitions/modules/tab.js

8
src/definitions/modules/tab.js

@ -455,7 +455,9 @@ $.fn.tab = function(parameters) {
'X-Remote': true 'X-Remote': true
}, },
onSuccess : function(response) { onSuccess : function(response) {
module.cache.add(fullTabPath, response);
if(settings.cacheType == 'response') {
module.cache.add(fullTabPath, response);
}
module.update.content(tabPath, response); module.update.content(tabPath, response);
if(tabPath == activeTabPath) { if(tabPath == activeTabPath) {
module.debug('Content loaded', tabPath); module.debug('Content loaded', tabPath);
@ -466,6 +468,9 @@ $.fn.tab = function(parameters) {
} }
settings.onFirstLoad.call($tab[0], tabPath, parameterArray, historyEvent); settings.onFirstLoad.call($tab[0], tabPath, parameterArray, historyEvent);
settings.onLoad.call($tab[0], tabPath, parameterArray, historyEvent); settings.onLoad.call($tab[0], tabPath, parameterArray, historyEvent);
if(settings.cacheType != 'response') {
module.cache.add(fullTabPath, $tab.html());
}
}, },
urlData: { urlData: {
tab: fullTabPath tab: fullTabPath
@ -876,6 +881,7 @@ $.fn.tab.settings = {
alwaysRefresh : false, // load tab content new every tab click alwaysRefresh : false, // load tab content new every tab click
cache : true, // cache the content requests to pull locally cache : true, // cache the content requests to pull locally
cacheType : 'html', // Whether to cache exact response, or to html cache contents after scripts execute
ignoreFirstLoad : false, // don't load remote content on first load ignoreFirstLoad : false, // don't load remote content on first load
apiSettings : false, // settings for api call apiSettings : false, // settings for api call

Loading…
Cancel
Save