This repository has been archived on 2022-08-19. You can view files and clone it, but cannot push or open issues or pull requests.
hydrogen-web/src/domain/session/room/timeline/tiles/SimpleTile.js

61 lines
1.4 KiB
JavaScript
Raw Normal View History

2019-03-09 00:34:56 +05:30
export default class SimpleTile {
2019-03-09 05:10:03 +05:30
constructor({entry, emitUpdate}) {
2019-03-09 00:34:56 +05:30
this._entry = entry;
2019-03-09 05:10:03 +05:30
this._emitUpdate = emitUpdate;
2019-03-09 00:34:56 +05:30
}
// view model props for all subclasses
// hmmm, could also do instanceof ... ?
get shape() {
// "gap" | "message" | "image" | ... ?
}
// don't show display name / avatar
// probably only for MessageTiles of some sort?
get isContinuation() {
return false;
}
get hasDateSeparator() {
return false;
}
get upperSortKey() {
return this._entry.sortKey;
}
get lowerSortKey() {
return this._entry.sortKey;
}
// TilesCollection contract
compareSortKey(key) {
return this._entry.sortKey.compare(key);
}
// update received for already included (falls within sort keys) entry
updateEntry(entry) {
2019-03-09 05:10:03 +05:30
// return names of props updated, or true for all, or null for no changes caused
return true;
}
2019-03-09 00:34:56 +05:30
2019-03-09 05:10:03 +05:30
// return whether the tile should be removed
// as SimpleTile only has one entry, the tile should be removed
removeEntry(entry) {
return true;
2019-03-09 00:34:56 +05:30
}
2019-03-09 05:10:03 +05:30
// SimpleTile can only contain 1 entry
2019-03-09 00:34:56 +05:30
tryIncludeEntry() {
return false;
}
// let item know it has a new sibling
updatePreviousSibling(prev) {
}
// let item know it has a new sibling
updateNextSibling(next) {
}
}