hydrogen-web/src/matrix/room/timeline/Direction.js

31 lines
531 B
JavaScript
Raw Normal View History

2019-05-12 23:55:41 +05:30
export default class Direction {
constructor(isForward) {
this._isForward = isForward;
}
get isForward() {
return this._isForward;
}
get isBackward() {
return !this.isForward;
}
asApiString() {
return this.isForward ? "f" : "b";
}
static get Forward() {
return _forward;
}
static get Backward() {
return _backward;
}
}
const _forward = Object.freeze(new Direction(true));
const _backward = Object.freeze(new Direction(false));