From 6b5c383dabfda853e6862a59a5b4edf9dda1c01e Mon Sep 17 00:00:00 2001 From: Jack Lukic Date: Sun, 15 May 2016 17:44:07 -0400 Subject: [PATCH] #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 --- src/definitions/modules/tab.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/definitions/modules/tab.js b/src/definitions/modules/tab.js index e1f995463..05be67b1c 100644 --- a/src/definitions/modules/tab.js +++ b/src/definitions/modules/tab.js @@ -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); @@ -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 @@ -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