Add flag to turn template caching on/off (default to off)

This commit is contained in:
Don Mitchell
2012-12-13 09:47:51 -05:00
parent 113c99e0b1
commit 41ca47edfc
2 changed files with 6 additions and 1 deletions

View File

@@ -15,6 +15,10 @@ $(document).ready(function() {
// pipelining (note, this doesn't happen on local runtimes). So if we set it on window, when we can access it from other
// scopes (namely the course-info tab)
window.$modalCover = $modalCover;
// Control whether template caching in local memory occurs (see template_loader.js). Caching screws up development but may
// be a good optimization in production (it works fairly well)
window.cachetemplates = false;
$body.append($modalCover);
$newComponentItem = $('.new-component-item');

View File

@@ -35,7 +35,8 @@
localStorageAvailable: function() {
try {
return 'localStorage' in window && window['localStorage'] !== null;
// window.cachetemplates is global set in base.js to turn caching on/off
return window.cachetemplates && 'localStorage' in window && window['localStorage'] !== null;
} catch (e) {
return false;
}