git ssb

6+

Dominic / epidemic-broadcast-trees



Commit 86a0d059a6618c5b0e01793ac5a710c66c9b4dda

Merge branch 'master' of github.com:dominictarr/epidemic-broadcast-trees

Dominic Tarr committed on 6/5/2017, 11:09:42 PM
Parent: 36fd23a2593c35e462fe4c1a3ff057b0a4dafa83
Parent: 39d19b2a5bb81817b9547ae72ef6c23de93df5cf

Files changed

README.mdchanged
README.mdView
@@ -42,9 +42,10 @@
4242
4343 function createChatModel (id, log) {
4444 //in this example, logs can be a map of arrays,
4545 var logs = {}
46- logs[id] = log || []
46 + if(id) logs[id] = log || []
47 +
4748 var onAppend = Obv()
4849 return {
4950 logs: logs,
5051 append: function append (msg) {
@@ -66,21 +67,22 @@
6667 //and only one value per instance (instead of potentially many named events)
6768
6869
6970 var stream = createEbtStream(
70- vectorClock,
7171 //pass a get(id, seq, cb)
7272 function (id, seq, cb) {
73- if(!chat.logs[id] || !chat.logs[id][seq])
73 + if(!chat.logs[id] || !chat.logs[id][seq-1])
7474 return cb(new Error('not found'))
75- cb(null, chat.logs[id][seq])
75 + cb(null, chat.logs[id][seq-1])
7676 },
7777 //pass append(msg, cb)
7878 function (msg, cb) {
7979 chat.append(msg)
8080 cb()
8181 }
82- )
82 + ) ({
83 + seqs: vectorClock,
84 + })
8385
8486 chat.onAppend(stream.onAppend)
8587
8688 return stream

Built with git-ssb-web