| 61 | return this.endTime - this.startTime |
| 62 | } |
| 63 | data(endTime: number, startTime: number = -1): string { |
| 64 | if ((endTime < this.startTime) || (endTime >= this.endTime)) { |
| 65 | throw new Error(`Cannot get data of time(${endTime})`) |
| 66 | } |
| 67 | const tmp: string[] = [] |
| 68 | for (let i = 0; i < this._events.len(); i++) { |
| 69 | const ev = this._events.get(i) |
| 70 | if (ev.time > endTime) { break } |
| 71 | if (startTime < ev.time && ev.time <= endTime) { |
| 72 | tmp.push(ev.data) |
| 73 | } |
| 74 | } |
| 75 | return tmp.join('') |
| 76 | } |
| 77 | snapshot(): string { |
| 78 | if (this._snapshotCache !== null) { |
| 79 | return this._snapshotCache |