Skip to content

Instantly share code, notes, and snippets.

/*
* idea: subscribe to websocket log
* but get prior history via HTTP.
* merge history and maintain sequence.
* upsert fns close over a Vue ref.
*/
const ref = x => ({value: x}); // mock Vue
let items = ref([]);
const events = ref([]);
// Map() of targetId -> event list
const targetEvents = computed(() => events.value
.filter(it => it.targetId !== undefined)
.reduce((ax, row) => ax.update(row.targetId, new List(),
items => items.push(row)),
new Map()));
const compacted = computed(() => {