implemented logTable method on data stores

This commit is contained in:
Kevin Jahns
2017-10-22 23:50:39 +02:00
parent 142a5ada60
commit 2b7d2ed1e6
15 changed files with 94 additions and 31 deletions

View File

@@ -1,12 +1,30 @@
import Tree from '../Util/Tree.js'
import RootID from '../Util/RootID.js'
import { getStruct } from '../Util/structReferences.js'
import { logID } from '../MessageHandler/messageToString.js'
export default class OperationStore extends Tree {
constructor (y) {
super()
this.y = y
}
logTable () {
const items = []
this.iterate(null, null, function (item) {
items.push({
id: logID(item),
origin: logID(item._origin === null ? null : item._origin._lastId),
left: logID(item._left === null ? null : item._left._lastId),
right: logID(item._right),
right_origin: logID(item._right_origin),
parent: logID(item._parent),
parentSub: item._parentSub,
deleted: item._deleted,
content: JSON.stringify(item._content)
})
})
console.table(items)
}
get (id) {
let struct = this.find(id)
if (struct === null && id instanceof RootID) {