Rename and document what local echo is
This commit is contained in:
parent
e3765ea8c5
commit
fca6def588
5 changed files with 15 additions and 15 deletions
|
@ -49,8 +49,8 @@ import { RoomNotificationStateStore } from "../../../stores/notifications/RoomNo
|
|||
import { NOTIFICATION_STATE_UPDATE, NotificationState } from "../../../stores/notifications/NotificationState";
|
||||
import AccessibleTooltipButton from "../elements/AccessibleTooltipButton";
|
||||
import { EchoChamber } from "../../../stores/local-echo/EchoChamber";
|
||||
import { CachedRoomKey, RoomCachedEcho } from "../../../stores/local-echo/RoomCachedEcho";
|
||||
import { PROPERTY_UPDATED } from "../../../stores/local-echo/CachedEcho";
|
||||
import { CachedRoomKey, RoomEchoChamber } from "../../../stores/local-echo/RoomEchoChamber";
|
||||
import { PROPERTY_UPDATED } from "../../../stores/local-echo/GenericEchoChamber";
|
||||
|
||||
interface IProps {
|
||||
room: Room;
|
||||
|
@ -108,7 +108,7 @@ export default class RoomTile extends React.PureComponent<IProps, IState> {
|
|||
private dispatcherRef: string;
|
||||
private roomTileRef = createRef<HTMLDivElement>();
|
||||
private notificationState: NotificationState;
|
||||
private roomProps: RoomCachedEcho;
|
||||
private roomProps: RoomEchoChamber;
|
||||
|
||||
constructor(props: IProps) {
|
||||
super(props);
|
||||
|
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
import { RoomCachedEcho } from "./RoomCachedEcho";
|
||||
import { RoomEchoChamber } from "./RoomEchoChamber";
|
||||
import { Room } from "matrix-js-sdk/src/models/room";
|
||||
import { EchoStore } from "./EchoStore";
|
||||
|
||||
|
@ -25,7 +25,7 @@ export class EchoChamber {
|
|||
private constructor() {
|
||||
}
|
||||
|
||||
public static forRoom(room: Room): RoomCachedEcho {
|
||||
return EchoStore.instance.getOrCreateEchoForRoom(room);
|
||||
public static forRoom(room: Room): RoomEchoChamber {
|
||||
return EchoStore.instance.getOrCreateChamberForRoom(room);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,9 +14,9 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
import { CachedEcho } from "./CachedEcho";
|
||||
import { GenericEchoChamber } from "./GenericEchoChamber";
|
||||
import { Room } from "matrix-js-sdk/src/models/room";
|
||||
import { RoomCachedEcho } from "./RoomCachedEcho";
|
||||
import { RoomEchoChamber } from "./RoomEchoChamber";
|
||||
import { RoomEchoContext } from "./RoomEchoContext";
|
||||
import { AsyncStoreWithClient } from "../AsyncStoreWithClient";
|
||||
import defaultDispatcher from "../../dispatcher/dispatcher";
|
||||
|
@ -36,7 +36,7 @@ const roomContextKey = (room: Room): ContextKey => `room-${room.roomId}`;
|
|||
export class EchoStore extends AsyncStoreWithClient<IState> {
|
||||
private static _instance: EchoStore;
|
||||
|
||||
private caches = new Map<ContextKey, CachedEcho<any, any, any>>();
|
||||
private caches = new Map<ContextKey, GenericEchoChamber<any, any, any>>();
|
||||
|
||||
constructor() {
|
||||
super(defaultDispatcher);
|
||||
|
@ -53,15 +53,15 @@ export class EchoStore extends AsyncStoreWithClient<IState> {
|
|||
return Array.from(this.caches.values()).map(e => e.context);
|
||||
}
|
||||
|
||||
public getOrCreateEchoForRoom(room: Room): RoomCachedEcho {
|
||||
public getOrCreateChamberForRoom(room: Room): RoomEchoChamber {
|
||||
if (this.caches.has(roomContextKey(room))) {
|
||||
return this.caches.get(roomContextKey(room)) as RoomCachedEcho;
|
||||
return this.caches.get(roomContextKey(room)) as RoomEchoChamber;
|
||||
}
|
||||
|
||||
const context = new RoomEchoContext(room);
|
||||
context.whenAnything(() => this.checkContexts());
|
||||
|
||||
const echo = new RoomCachedEcho(context);
|
||||
const echo = new RoomEchoChamber(context);
|
||||
echo.setClient(this.matrixClient);
|
||||
this.caches.set(roomContextKey(room), echo);
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ export async function implicitlyReverted() {
|
|||
|
||||
export const PROPERTY_UPDATED = "property_updated";
|
||||
|
||||
export abstract class CachedEcho<C extends EchoContext, K, V> extends EventEmitter {
|
||||
export abstract class GenericEchoChamber<C extends EchoContext, K, V> extends EventEmitter {
|
||||
private cache = new Map<K, {txn: EchoTransaction, val: V}>();
|
||||
protected matrixClient: MatrixClient;
|
||||
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
import { CachedEcho, implicitlyReverted, PROPERTY_UPDATED } from "./CachedEcho";
|
||||
import { GenericEchoChamber, implicitlyReverted, PROPERTY_UPDATED } from "./GenericEchoChamber";
|
||||
import { getRoomNotifsState, setRoomNotifsState } from "../../RoomNotifs";
|
||||
import { RoomEchoContext } from "./RoomEchoContext";
|
||||
import { _t } from "../../languageHandler";
|
||||
|
@ -27,7 +27,7 @@ export enum CachedRoomKey {
|
|||
NotificationVolume,
|
||||
}
|
||||
|
||||
export class RoomCachedEcho extends CachedEcho<RoomEchoContext, CachedRoomKey, CachedRoomValues> {
|
||||
export class RoomEchoChamber extends GenericEchoChamber<RoomEchoContext, CachedRoomKey, CachedRoomValues> {
|
||||
private properties = new Map<CachedRoomKey, CachedRoomValues>();
|
||||
|
||||
public constructor(context: RoomEchoContext) {
|
Loading…
Reference in a new issue