forked from mystiq/hydrogen-web
Make event ID function public
This commit is contained in:
parent
bbd174cd67
commit
bcfca9ad9a
1 changed files with 5 additions and 5 deletions
|
@ -3,6 +3,10 @@ import {TimelineEvent} from "../matrix/storage/types";
|
||||||
|
|
||||||
export const TIMELINE_START_TOKEN = "timeline_start";
|
export const TIMELINE_START_TOKEN = "timeline_start";
|
||||||
|
|
||||||
|
export function eventId(i: number): string {
|
||||||
|
return `$event${i}`;
|
||||||
|
}
|
||||||
|
|
||||||
export class TimelineMock {
|
export class TimelineMock {
|
||||||
private _counter: number;
|
private _counter: number;
|
||||||
private _dagOrder: TimelineEvent[];
|
private _dagOrder: TimelineEvent[];
|
||||||
|
@ -21,7 +25,7 @@ export class TimelineMock {
|
||||||
}
|
}
|
||||||
|
|
||||||
_createEvent(func?: (eventId: string) => TimelineEvent): TimelineEvent {
|
_createEvent(func?: (eventId: string) => TimelineEvent): TimelineEvent {
|
||||||
const id = `$event${this._counter++}`;
|
const id = eventId(this._counter++);
|
||||||
return func ? func(id) : this._defaultEvent(id);
|
return func ? func(id) : this._defaultEvent(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,10 +150,6 @@ export class TimelineMock {
|
||||||
export function tests() {
|
export function tests() {
|
||||||
const SENDER = "@alice:hs.tdl";
|
const SENDER = "@alice:hs.tdl";
|
||||||
|
|
||||||
function eventId(i: number): string {
|
|
||||||
return `$event${i}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
function eventIds(from: number, to: number): string[] {
|
function eventIds(from: number, to: number): string[] {
|
||||||
return [...Array(to-from).keys()].map(i => eventId(i + from));
|
return [...Array(to-from).keys()].map(i => eventId(i + from));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue