git ssb

7+

dinoworm ๐Ÿ› / patchcore



Tree: e69a4bdedf11f26f5a8b25434154fefafbf6ba2a

Files: e69a4bdedf11f26f5a8b25434154fefafbf6ba2a / feed / pull / type.js

586 bytesRaw
1const nest = require('depnest')
2const extend = require('xtend')
3
4exports.gives = nest('feed.pull.type')
5exports.needs = nest('sbot.pull.messagesByType', 'first')
6exports.create = function (api) {
7 return nest('feed.pull.type', (type) => {
8 if (typeof type !== 'string') throw new Error('a type must be specified')
9
10 return function (opts) {
11 opts = extend(opts, {
12 type,
13 // handle last item passed in as lt
14 lt: opts.lt && typeof opts.lt === 'object' ? opts.lt.timestamp : opts.lt
15 })
16
17 return api.sbot.pull.messagesByType(opts)
18 }
19 })
20}
21

Built with git-ssb-web