Mercurial > bugzilla-dashboard
view js/modules/cache.js @ 89:ee0a4597c067
Added a really basic error log that gets populated when the wrong username/pass is entered. Also, the username/password prompt for login now emphasizes the fact that it is a bugzilla login.
author | Atul Varma <avarma@mozilla.com> |
---|---|
date | Mon, 26 Apr 2010 17:45:02 -0700 |
parents | e3de1fe32f40 |
children | 00d23d6d41b4 |
line wrap: on
line source
Require.modules["cache"] = function(exports, require) { const CACHE_NAME = "cache"; var storage = require("storage"); var cache = storage.getItem(CACHE_NAME); if (cache) cache = JSON.parse(cache); else cache = {}; exports.set = function set(key, value) { cache[key] = value; // Remove the key first, to get around a strange iPad // issue: http://stackoverflow.com/questions/2603682/is-anyone-else-receiving-a-quota-exceeded-err-on-their-ipad-when-accessing-locals storage.removeItem(CACHE_NAME); // TODO: We should really catch QUOTA_EXCEEDED_ERR here, // which could be thrown if the user is in private // browsing mode. storage.setItem(CACHE_NAME, JSON.stringify(cache)); }; exports.get = function get(key) { return cache[key]; }; exports.clear = function clear() { storage.removeItem(CACHE_NAME); cache = {}; }; };