Files: 6b5fb10bffe7df13233ba65f8a3631d6121ed3cd / modules / progress / html / peer.js
602 bytesRaw
1 | var {computed, when} = require('mutant') |
2 | var nest = require('depnest') |
3 | |
4 | exports.gives = nest('progress.html.peer') |
5 | |
6 | exports.needs = nest({ |
7 | 'progress.html.render': 'first', |
8 | 'progress.obs.peer': 'first', |
9 | 'progress.obs.global': 'first' |
10 | }) |
11 | |
12 | exports.create = function (api) { |
13 | return nest('progress.html.peer', function (id) { |
14 | var progress = api.progress.obs.peer(id) |
15 | var feeds = api.progress.obs.global().feeds |
16 | |
17 | var value = computed([progress, feeds], (pending, feeds) => { |
18 | return (feeds - pending) / feeds |
19 | }) |
20 | |
21 | return when(progress, api.progress.html.render(value)) |
22 | }) |
23 | } |
24 |
Built with git-ssb-web