Commit b05fea73827c1594cc91f3825ed034f8be6f91bc
allow to be put into remote mode
Dominic Tarr committed on 7/26/2016, 4:24:08 AMParent: 1a5237c6cc7957a4a1e69cd21fe4cf5d16c4237e
Files changed
index.js | changed |
index.js | ||
---|---|---|
@@ -15,17 +15,20 @@ | ||
15 | 15 | && !Array.isArray(o) |
16 | 16 | ) |
17 | 17 | } |
18 | 18 | |
19 | -module.exports = function (ssb, keys) { | |
20 | - | |
19 | +module.exports = function (ssb, keys, opts) { | |
20 | + opts = opts || {} | |
21 | 21 | if(!ssb.add) |
22 | - throw new Error('*must* install feeds on this ssb instance') | |
22 | + throw new Error('*must* install feeds on ssb instance') | |
23 | 23 | |
24 | 24 | var queue = Queue(function (msg, prev, cb) { |
25 | - if(prev) next(prev) | |
25 | + if(prev && !opts.remote) next(prev) | |
26 | 26 | else |
27 | - ssb.getLatest(keys.id, function (_, prev) { next(prev) }) | |
27 | + ssb.getLatest(keys.id, function (err, prev) { | |
28 | + if(err) cb(err) | |
29 | + else next(prev) | |
30 | + }) | |
28 | 31 | |
29 | 32 | function next (prev) { |
30 | 33 | ssb.add( |
31 | 34 | util.create( |
@@ -60,4 +63,5 @@ | ||
60 | 63 | publish: publish |
61 | 64 | } |
62 | 65 | } |
63 | 66 | |
67 | + |
Built with git-ssb-web