git ssb

10+

Matt McKegg / patchwork



Tree: a5f9e9c80b3948d0c40559bef2b6be37e82fcd6d

Files: a5f9e9c80b3948d0c40559bef2b6be37e82fcd6d / modules / progress / html / peer.js

614 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.global': '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.global().feeds
16
17 var value = computed([progress, feeds], (pending, feeds) => {
18 return (feeds - pending) / feeds
19 })
20
21 return api.progress.html.render(value, when(progress, '-pending'))
22 })
23}
24

Built with git-ssb-web