Files: 927589fec8bb0961a8205fae25069ff9a9eb1da4 / modules / feed / html / thread.js
642 bytesRaw
1 | var { h, computed, map } = require('mutant') |
2 | var nest = require('depnest') |
3 | |
4 | exports.needs = nest({ |
5 | 'feed.obs.thread': 'first', |
6 | 'message.html.render': 'first' |
7 | }) |
8 | |
9 | exports.gives = nest('feed.html.thread') |
10 | |
11 | exports.create = function (api) { |
12 | return nest('feed.html.thread', function (rootId) { |
13 | var thread = api.feed.obs.thread(rootId) |
14 | |
15 | var container = h('Thread', [ |
16 | map(thread.messages, (msg) => { |
17 | return computed([msg, thread.previousKey(msg)], (msg, previousId) => { |
18 | return api.message.html.render(msg, {previousId}) |
19 | }) |
20 | }) |
21 | ]) |
22 | |
23 | container.sync = thread.sync |
24 | return container |
25 | }) |
26 | } |
27 |
Built with git-ssb-web