mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-22 19:14:52 +01:00
convert Direction to ts
This commit is contained in:
parent
ed082c9869
commit
85c8415acd
@ -15,34 +15,29 @@ limitations under the License.
|
||||
*/
|
||||
|
||||
export class Direction {
|
||||
constructor(isForward) {
|
||||
this._isForward = isForward;
|
||||
constructor(public readonly isForward: boolean) {
|
||||
}
|
||||
|
||||
get isForward() {
|
||||
return this._isForward;
|
||||
}
|
||||
|
||||
get isBackward() {
|
||||
get isBackward(): boolean {
|
||||
return !this.isForward;
|
||||
}
|
||||
|
||||
asApiString() {
|
||||
asApiString(): string {
|
||||
return this.isForward ? "f" : "b";
|
||||
}
|
||||
|
||||
reverse() {
|
||||
reverse(): Direction {
|
||||
return this.isForward ? Direction.Backward : Direction.Forward
|
||||
}
|
||||
|
||||
static get Forward() {
|
||||
static get Forward(): Direction {
|
||||
return _forward;
|
||||
}
|
||||
|
||||
static get Backward() {
|
||||
static get Backward(): Direction {
|
||||
return _backward;
|
||||
}
|
||||
}
|
||||
|
||||
const _forward = Object.freeze(new Direction(true));
|
||||
const _backward = Object.freeze(new Direction(false));
|
||||
const _forward = new Direction(true);
|
||||
const _backward = new Direction(false);
|
@ -17,7 +17,7 @@ limitations under the License.
|
||||
|
||||
import {SortedArray, AsyncMappedList, ConcatList, ObservableArray} from "../../../observable/index.js";
|
||||
import {Disposables} from "../../../utils/Disposables.js";
|
||||
import {Direction} from "./Direction.js";
|
||||
import {Direction} from "./Direction";
|
||||
import {TimelineReader} from "./persistence/TimelineReader.js";
|
||||
import {PendingEventEntry} from "./entries/PendingEventEntry.js";
|
||||
import {RoomMember} from "../members/RoomMember.js";
|
||||
|
@ -15,7 +15,7 @@ limitations under the License.
|
||||
*/
|
||||
|
||||
import {BaseEntry} from "./BaseEntry";
|
||||
import {Direction} from "../Direction.js";
|
||||
import {Direction} from "../Direction";
|
||||
import {isValidFragmentId} from "../common.js";
|
||||
import {KeyLimits} from "../../../storage/common";
|
||||
|
||||
|
@ -15,7 +15,7 @@ limitations under the License.
|
||||
*/
|
||||
|
||||
import {directionalConcat, directionalAppend} from "./common.js";
|
||||
import {Direction} from "../Direction.js";
|
||||
import {Direction} from "../Direction";
|
||||
import {EventEntry} from "../entries/EventEntry.js";
|
||||
import {FragmentBoundaryEntry} from "../entries/FragmentBoundaryEntry.js";
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user