aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlessio Vanni <vannilla@firemail.cc>2019-05-27 16:53:43 +0200
committerAlessio Vanni <vannilla@firemail.cc>2019-05-27 16:53:43 +0200
commita7de3b950c9cf73e5fc94e3e58e31bdfd759ef53 (patch)
treed9922371db596672784b89470c14a62c2bfd4570
parent9e544679ac4dff01aebf38bdba3bd038d605bd89 (diff)
downloadematrix-a7de3b950c9cf73e5fc94e3e58e31bdfd759ef53.tar.lz
ematrix-a7de3b950c9cf73e5fc94e3e58e31bdfd759ef53.tar.xz
ematrix-a7de3b950c9cf73e5fc94e3e58e31bdfd759ef53.zip
Load cache earlier
The cache should be available, either read from the database or as an empty object, before any asset is fetched.
-rw-r--r--js/assets.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/js/assets.js b/js/assets.js
index 7a04a32..e62bb5d 100644
--- a/js/assets.js
+++ b/js/assets.js
@@ -105,6 +105,16 @@
cacheRegistryCallbacks = [callback];
cacheRegistryReady = true;
+
+ let onRead = function (bin) {
+ if (!bin || !bin['assetCacheRegistry']) {
+ cacheRegistry = {};
+ } else {
+ cacheRegistry = bin['assetCacheRegistry'];
+ }
+ };
+
+ vAPI.cacheStorage.get('assetCacheRegistry', onRead);
let f;
while ((f = cacheRegistryCallbacks.shift())) {