rule out double-callbacks when clearing cache

pull/1/head
ansuz 4 years ago
parent b307b98926
commit e9033d8b0a

@ -4,7 +4,8 @@ define([
'/common/outer/cache-store.js', '/common/outer/cache-store.js',
'/bower_components/localforage/dist/localforage.min.js', '/bower_components/localforage/dist/localforage.min.js',
'/customize/application_config.js', '/customize/application_config.js',
], function (Constants, Hash, Cache, localForage, AppConfig) { '/common/common-util.js',
], function (Constants, Hash, Cache, localForage, AppConfig, Util) {
var LocalStore = {}; var LocalStore = {};
LocalStore.setThumbnail = function (key, value, cb) { LocalStore.setThumbnail = function (key, value, cb) {
@ -120,10 +121,10 @@ define([
return void AppConfig.customizeLogout(cb); return void AppConfig.customizeLogout(cb);
} }
cb = cb || function () {}; cb = Util.once(cb || function () {});
try { try {
Cache.clear(cb); // XXX might call back twice in extreme circumstances? Cache.clear(cb);
} catch (e) { } catch (e) {
console.error(e); console.error(e);
cb(); cb();

Loading…
Cancel
Save