git ssb

0+

alanz / patchwork



forked from Matt McKegg / patchwork

Tree: 9460421baaceb73b6c5819e685d30b5179c7e7c4

Files: 9460421baaceb73b6c5819e685d30b5179c7e7c4 / modules / progress / html / peer.js

619 bytesRaw
1var {computed, when} = require('mutant')
2var nest = require('depnest')
3
4exports.gives = nest('progress.html.peer')
5
6exports.needs = nest({
7 'progress.html.render': 'first',
8 'progress.obs.peer': 'first',
9 'progress.obs.replicate': 'first'
10})
11
12exports.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.replicate().feeds
16 var value = computed([progress, feeds], (pending, feeds) => {
17 return (feeds - pending) / feeds
18 })
19
20 return api.progress.html.render(value, when(progress, '-pending'))
21 })
22}
23

Built with git-ssb-web