matrix-react-sdk
Version:
SDK for matrix.org using React
28 lines (27 loc) • 1.24 kB
TypeScript
import { MatrixClient } from "matrix-js-sdk/src/matrix";
import { EventEmitter } from "events";
import { EchoContext } from "./EchoContext";
import { RunFn } from "./EchoTransaction";
export declare function implicitlyReverted(): Promise<void>;
export declare const PROPERTY_UPDATED = "property_updated";
export declare abstract class GenericEchoChamber<C extends EchoContext, K, V> extends EventEmitter {
readonly context: C;
private lookupFn;
private cache;
protected matrixClient: MatrixClient | null;
protected constructor(context: C, lookupFn: (key: K) => V);
setClient(client: MatrixClient | null): void;
protected abstract onClientChanged(oldClient: MatrixClient | null, newClient: MatrixClient | null): void;
/**
* Gets a value. If the key is in flight, the cached value will be returned. If
* the key is not in flight then the lookupFn provided to this class will be
* called instead.
* @param key The key to look up.
* @returns The value for the key.
*/
getValue(key: K): V;
private cacheVal;
private decacheKey;
protected markEchoReceived(key: K): void;
setValue(auditName: string, key: K, targetVal: V, runFn: RunFn, revertFn: RunFn): void;
}