From 4fbf705ae53a87ed7c96530ce90a4eadbdbee5e3 Mon Sep 17 00:00:00 2001 From: Willem Date: Sun, 24 Jan 2016 19:44:00 +0100 Subject: [PATCH] Added clearCache function --- README.md | 7 +++ es5-ff-spa-loader.js | 50 ++++++++++++++++---- example/www_static/js/controller/page-foo.js | 27 ++++++++--- test/test-exports.js | 6 +++ 4 files changed, 75 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 7af113e..0e3dab7 100644 --- a/README.md +++ b/README.md @@ -106,6 +106,12 @@ A javascript library providing server defined loading of assets for a single pag * cache.css = The cache backend for for css, null is auto select,false is disable. (default: null) * cache.cssData = The cache backend for for cssData, null is auto select,false is disable. (default: null) +## Functions + + The functions iin FFSpaLoader.*; + + * clearServerUrl(cb) = Clears the cached server url so after reload user get promted again. + * clearCache(cb) = Clears the cached values so after reload all assets get refetched. ## Factory @@ -196,6 +202,7 @@ Add unit tests for any new or changed functionality. Lint and test your code. * Changed websql option openDatabase to returning open function. * Fixed sqlitePlugin open function was typo on openDatabase. * Added websql table option. (defaults to 'cache_store') +* Added clearCache function. ### 0.1.0 * Moved options.server.question to options.question. diff --git a/es5-ff-spa-loader.js b/es5-ff-spa-loader.js index 7f6ae08..8046f98 100644 --- a/es5-ff-spa-loader.js +++ b/es5-ff-spa-loader.js @@ -431,7 +431,7 @@ }); }; - var cleanupCache = function (resources, cb) { + var cleanupCache = function (resources, deleteAll, cb) { var typedKeys = {}; resources.forEach(function (r) { var typeKey = typedKeys[r.type]; @@ -456,11 +456,11 @@ return cb(err); } if (value === null) { - return cb(null); + return cb(null); // meta has no keys } var diff = []; for (var i=0;i