git ssb

1+

Daan Patchwork / patchwork



Tree: 1006d0c4dde00ee503cde396de716125b96524c1

Files: 1006d0c4dde00ee503cde396de716125b96524c1 / 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