jsonrpc: ts-client use object instead of array for contextEmitters (#3740)

reason:
the array solution has many empty elements in between accounts in practice,
which is annoying when debugging desktop
This commit is contained in:
Simon Laux
2022-11-08 21:22:51 +01:00
committed by GitHub
parent fcf0cb5d69
commit 11a6991b5c

View File

@@ -28,14 +28,14 @@ type ContextEvents = { ALL: (event: Event) => void } & {
};
export type DcEvent = Event;
export type DcEventType<T extends Event["type"]> = Extract<Event, { type: T }>
export type DcEventType<T extends Event["type"]> = Extract<Event, { type: T }>;
export class BaseDeltaChat<
Transport extends BaseTransport<any>
> extends TinyEmitter<Events> {
rpc: RawClient;
account?: T.Account;
private contextEmitters: TinyEmitter<ContextEvents>[] = [];
private contextEmitters: { [key: number]: TinyEmitter<ContextEvents> } = {};
constructor(public transport: Transport) {
super();
this.rpc = new RawClient(this.transport);