git ssb

2+

mixmix / ticktack



Commit 9586c1b4818398af637ad0672a2db42e5487ab29

disable bits that are not strictly needed

Dominic Tarr committed on 8/14/2017, 12:28:34 PM
Parent: 7d3eedbfb460afbb17537a609239a3d957ecc662

Files changed

state/obs.jschanged
state/obs.jsView
@@ -21,12 +21,14 @@
2121
2222 return nest('state.obs.threads', function buildThreadObs() {
2323 if(threadsObs) return threadsObs
2424
25- var initial
26- try { initial = JSON.parse(localStorage.threadsState) }
27- catch (_) { }
25+// var initial
26+// try { initial = JSON.parse(localStorage.threadsState) }
27+// catch (_) { }
28+//
2829
30+ initial = {}
2931 var lastTimestamp = initial ? initial.last : Date.now()
3032 var firstTimestamp = initial ? initial.first || Date.now() : Date.now()
3133
3234 function unbox () {
@@ -54,29 +56,11 @@
5456 //value recovered from localStorage
5557 initial
5658 )
5759
58- threadsObs(function (threadsState) {
59- if(threadsState.ended && threadsState.ended !== true)
60- console.error('threadObs error:', threadsState.ended)
61- })
62-
63- var timer
64- //keep localStorage up to date
65- threadsObs(function (threadsState) {
66- if(timer) return
67- timer = setTimeout(function () {
68- timer = null
69- threadsState.last = lastTimestamp
70- console.log('save state')
71- localStorage.threadsState = JSON.stringify(threadsState)
72- }, 1000)
73- })
74-
7560 //stream live messages. this *should* work.
7661 //there is no back pressure on new events
7762 //only a show more on the top (currently)
78-
7963 pull(
8064 Next(function () {
8165 return api.sbot.pull.log({limit: 500, gt: firstTimestamp, live: true})
8266 }),
@@ -86,8 +70,29 @@
8670 threadsObs.set(threadReduce(threadsObs.value, data))
8771 })
8872 )
8973
74+
75+ threadsObs(function (threadsState) {
76+ if(threadsState.ended && threadsState.ended !== true)
77+ console.error('threadObs error:', threadsState.ended)
78+ })
79+
80+// var timer
81+// //keep localStorage up to date
82+// threadsObs(function (threadsState) {
83+// if(timer) return
84+// timer = setTimeout(function () {
85+// timer = null
86+// threadsState.last = lastTimestamp
87+// console.log('save state')
88+// localStorage.threadsState = JSON.stringify(threadsState)
89+// }, 1000)
90+// })
91+//
92+
9093 return threadsObs
9194 })
9295 }
9396
97+
98+

Built with git-ssb-web