mirror of
https://github.com/chatmail/core.git
synced 2026-05-22 16:26:31 +03:00
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:
@@ -28,14 +28,14 @@ type ContextEvents = { ALL: (event: Event) => void } & {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export type DcEvent = Event;
|
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<
|
export class BaseDeltaChat<
|
||||||
Transport extends BaseTransport<any>
|
Transport extends BaseTransport<any>
|
||||||
> extends TinyEmitter<Events> {
|
> extends TinyEmitter<Events> {
|
||||||
rpc: RawClient;
|
rpc: RawClient;
|
||||||
account?: T.Account;
|
account?: T.Account;
|
||||||
private contextEmitters: TinyEmitter<ContextEvents>[] = [];
|
private contextEmitters: { [key: number]: TinyEmitter<ContextEvents> } = {};
|
||||||
constructor(public transport: Transport) {
|
constructor(public transport: Transport) {
|
||||||
super();
|
super();
|
||||||
this.rpc = new RawClient(this.transport);
|
this.rpc = new RawClient(this.transport);
|
||||||
|
|||||||
Reference in New Issue
Block a user