git ssb

1+

Daan Patchwork / patchwork



Tree: 4d9f238ff73f7136cd292da88f06c17fe1a8c445

Files: 4d9f238ff73f7136cd292da88f06c17fe1a8c445 / lib / depject / progress / html / peer.js

650 bytesRaw
1const { computed, when } = require('mutant')
2const nest = require('depnest')
3const renderProgress = require('../../../progress/html/render')
4
5exports.gives = nest('progress.html.peer')
6
7exports.needs = nest({
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 const progress = api.progress.obs.peer(id)
15 const feeds = api.progress.obs.replicate().feeds
16 const value = computed([progress, feeds], (pending, feeds) => {
17 return (feeds - pending) / feeds
18 })
19
20 return renderProgress(value, when(progress, '-pending'))
21 })
22}
23

Built with git-ssb-web