Skip to content

Commit

Permalink
Semantic-Org#2534 - Add cacheType setting, response or html. Response…
Browse files Browse the repository at this point in the history
… caches original response so that execution occurs in same way each load. HTML caches final html content after callbacks
  • Loading branch information
jlukic committed May 15, 2016
1 parent 7140349 commit 6b5c383
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/definitions/modules/tab.js
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,9 @@ $.fn.tab = function(parameters) {
'X-Remote': true
},
onSuccess : function(response) {
module.cache.add(fullTabPath, response);
if(settings.cacheType == 'response') {
module.cache.add(fullTabPath, response);
}
module.update.content(tabPath, response);
if(tabPath == activeTabPath) {
module.debug('Content loaded', tabPath);
Expand All @@ -466,6 +468,9 @@ $.fn.tab = function(parameters) {
}
settings.onFirstLoad.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: {
tab: fullTabPath
Expand Down Expand Up @@ -876,6 +881,7 @@ $.fn.tab.settings = {

alwaysRefresh : false, // load tab content new every tab click
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

apiSettings : false, // settings for api call
Expand Down

0 comments on commit 6b5c383

Please sign in to comment.