Mercurial > code > home > repos > streamed-graph
comparison src/SourceGraph.ts @ 137:a8939c717015
still trying to get build right, but there are other update bugs too
author | drewp@bigasterisk.com |
---|---|
date | Sat, 06 May 2023 15:34:40 -0700 |
parents | 73a70d00fb74 |
children | cf642d395be4 |
comparison
equal
deleted
inserted
replaced
136:d00036808948 | 137:a8939c717015 |
---|---|
38 // clear store here? | 38 // clear store here? |
39 | 39 |
40 // maybe the event messages should be 'add' and 'del', | 40 // maybe the event messages should be 'add' and 'del', |
41 // for less parsing and clearer order of ops. | 41 // for less parsing and clearer order of ops. |
42 ev.addEventListener("patch", async (ev) => { | 42 ev.addEventListener("patch", async (ev) => { |
43 // this is reentrant- ok? | |
44 | |
43 const patchMsg = JSON.parse((ev as any).data); | 45 const patchMsg = JSON.parse((ev as any).data); |
44 | 46 |
45 const p = new Patch(); | 47 const p = new Patch(); |
46 | 48 |
47 const parser = new JsonLdParser(); | 49 const parser = new JsonLdParser(); |
51 await p.streamImport(parser); | 53 await p.streamImport(parser); |
52 this.isCurrent = true; | 54 this.isCurrent = true; |
53 | 55 |
54 p.applyToStore(this.store); | 56 p.applyToStore(this.store); |
55 console.log("patchlife0: eventsream store changed"); | 57 console.log("patchlife0: eventsream store changed"); |
58 // firing before there are listeners | |
56 this.sourceGraphChanged.emit(p); | 59 this.sourceGraphChanged.emit(p); |
57 if (firstPatch) { | 60 if (firstPatch) { |
58 firstPatch = false; | 61 firstPatch = false; |
59 res(); | 62 res(); |
60 } | 63 } |