Commit ea39c986dd24cf5a10156a893292a9c4b5c66ba0
only ask server for config if config doesn't already exist in localStorage
Ev Bogue committed on 5/5/2018, 6:52:14 PMParent: a93635d6f2271be30eab8d4cdc8444d0b3914861
Files changed
config.js | changed |
config.js | ||
---|---|---|
@@ -2,16 +2,18 @@ | ||
2 | 2 … | |
3 | 3 … | module.exports = function () { |
4 | 4 … | var host = window.location.origin |
5 | 5 … | |
6 | - http.get(host + '/get-config', function (res) { | |
7 | - res.on('data', function (data, remote) { | |
8 | - config = data | |
9 | - localStorage[host] = config | |
6 … | + if (localStorage[host]) | |
7 … | + var config = JSON.parse(localStorage[host]) | |
8 … | + else | |
9 … | + http.get(host + '/get-config', function (res) { | |
10 … | + res.on('data', function (data, remote) { | |
11 … | + var config = data | |
12 … | + localStorage[host] = config | |
13 … | + }) | |
10 | 14 … | }) |
11 | - }) | |
12 | 15 … | |
13 | - var config = JSON.parse(localStorage[host]) | |
14 | 16 … | |
15 | 17 … | config.blobsUrl = host + '/blobs/get/' |
16 | 18 … | config.emojiUrl = host + '/img/emoji/' |
17 | 19 … |
Built with git-ssb-web