mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-28 05:55:15 +01:00
30 lines
530 B
JavaScript
30 lines
530 B
JavaScript
|
|
||
|
const _forward = Object.freeze(new Direction(true));
|
||
|
const _backward = Object.freeze(new Direction(false));
|
||
|
|
||
|
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;
|
||
|
}
|
||
|
}
|