From 6cb3e84e0fa3d2dab8739ad030efa8fbb0ba7e24 Mon Sep 17 00:00:00 2001 From: Kerrick Long Date: Sun, 29 Apr 2012 03:32:45 -0500 Subject: [PATCH] moved cache clearing to its own method for future development --- html/background.html | 3 +-- js/common.js | 11 +++++++++++ 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/html/background.html b/html/background.html index 07b789a..a99e869 100644 --- a/html/background.html +++ b/html/background.html @@ -12,8 +12,7 @@ background = new Background(); function initBackground() { - cache.removeAll(); - button.setBadgeDefaults(); + background.clearCache(); chrome.tabs.onUpdated.addListener(background.prepareBrowserAction); background.watchMail(); reddit.getReddits(); diff --git a/js/common.js b/js/common.js index e3b2928..8d711b1 100644 --- a/js/common.js +++ b/js/common.js @@ -934,6 +934,17 @@ function Background() { return true; } +/** + * Clear cached data and reset cleared browser buttons + * @alias Background.clearCache(tabId, info, tab) + * @return {Boolean} Returns true. + * @method + */ + Background.prototype.clearCache = function () { + cache.removeAll(); + button.setBadgeDefaults(); + }; + /** * Prepare the browser action (badge, popup, etc.) for a given tab. * @alias Background.prepareBrowserAction(tabId, info, tab)