Commit 44961c2780748726db65c43b176255be3a0de333
timeAgo: use less resources to update timestamps
still could be optimised a lot!Matt McKegg committed on 6/28/2017, 6:15:53 AM
Parent: e92ded1555551390c87a00d5e77f02935f60f00e
Files changed
lib/timeAgo.js | changed |
lib/timeAgo.js | ||
---|---|---|
@@ -12,14 +12,16 @@ | ||
12 | 12 … | var timer |
13 | 13 … | var value = Value(Time(timestamp)) |
14 | 14 … | return computed([value], (a) => a, { |
15 | 15 … | onListen: () => { |
16 | - timer = setInterval(refresh, 5e3) | |
16 … | + timer = setInterval(refresh, 30e3) | |
17 | 17 … | refresh() |
18 | 18 … | }, |
19 | 19 … | onUnlisten: () => { |
20 | 20 … | clearInterval(timer) |
21 | 21 … | } |
22 … | + }, { | |
23 … | + idle: true | |
22 | 24 … | }) |
23 | 25 … | |
24 | 26 … | function refresh () { |
25 | 27 … | value.set(Time(timestamp)) |
Built with git-ssb-web