Files: 5cea9df7483c8eadbe82003ae98e7bd65ad305ac / feed / pull / type.js
575 bytesRaw
1 | const nest = require('depnest') |
2 | const extend = require('xtend') |
3 | |
4 | exports.gives = nest('feed.pull.type') |
5 | exports.needs = nest('sbot.pull.messagesByType', 'first') |
6 | exports.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: 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