mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 03:25:12 +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 {
|
export class Direction {
|
||||||
constructor(isForward) {
|
constructor(public readonly isForward: boolean) {
|
||||||
this._isForward = isForward;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
get isForward() {
|
get isBackward(): boolean {
|
||||||
return this._isForward;
|
|
||||||
}
|
|
||||||
|
|
||||||
get isBackward() {
|
|
||||||
return !this.isForward;
|
return !this.isForward;
|
||||||
}
|
}
|
||||||
|
|
||||||
asApiString() {
|
asApiString(): string {
|
||||||
return this.isForward ? "f" : "b";
|
return this.isForward ? "f" : "b";
|
||||||
}
|
}
|
||||||
|
|
||||||
reverse() {
|
reverse(): Direction {
|
||||||
return this.isForward ? Direction.Backward : Direction.Forward
|
return this.isForward ? Direction.Backward : Direction.Forward
|
||||||
}
|
}
|
||||||
|
|
||||||
static get Forward() {
|
static get Forward(): Direction {
|
||||||
return _forward;
|
return _forward;
|
||||||
}
|
}
|
||||||
|
|
||||||
static get Backward() {
|
static get Backward(): Direction {
|
||||||
return _backward;
|
return _backward;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const _forward = Object.freeze(new Direction(true));
|
const _forward = new Direction(true);
|
||||||
const _backward = Object.freeze(new Direction(false));
|
const _backward = new Direction(false);
|
@ -17,7 +17,7 @@ limitations under the License.
|
|||||||
|
|
||||||
import {SortedArray, AsyncMappedList, ConcatList, ObservableArray} from "../../../observable/index.js";
|
import {SortedArray, AsyncMappedList, ConcatList, ObservableArray} from "../../../observable/index.js";
|
||||||
import {Disposables} from "../../../utils/Disposables.js";
|
import {Disposables} from "../../../utils/Disposables.js";
|
||||||
import {Direction} from "./Direction.js";
|
import {Direction} from "./Direction";
|
||||||
import {TimelineReader} from "./persistence/TimelineReader.js";
|
import {TimelineReader} from "./persistence/TimelineReader.js";
|
||||||
import {PendingEventEntry} from "./entries/PendingEventEntry.js";
|
import {PendingEventEntry} from "./entries/PendingEventEntry.js";
|
||||||
import {RoomMember} from "../members/RoomMember.js";
|
import {RoomMember} from "../members/RoomMember.js";
|
||||||
|
@ -15,7 +15,7 @@ limitations under the License.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import {BaseEntry} from "./BaseEntry";
|
import {BaseEntry} from "./BaseEntry";
|
||||||
import {Direction} from "../Direction.js";
|
import {Direction} from "../Direction";
|
||||||
import {isValidFragmentId} from "../common.js";
|
import {isValidFragmentId} from "../common.js";
|
||||||
import {KeyLimits} from "../../../storage/common";
|
import {KeyLimits} from "../../../storage/common";
|
||||||
|
|
||||||
|
@ -15,7 +15,7 @@ limitations under the License.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import {directionalConcat, directionalAppend} from "./common.js";
|
import {directionalConcat, directionalAppend} from "./common.js";
|
||||||
import {Direction} from "../Direction.js";
|
import {Direction} from "../Direction";
|
||||||
import {EventEntry} from "../entries/EventEntry.js";
|
import {EventEntry} from "../entries/EventEntry.js";
|
||||||
import {FragmentBoundaryEntry} from "../entries/FragmentBoundaryEntry.js";
|
import {FragmentBoundaryEntry} from "../entries/FragmentBoundaryEntry.js";
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user