From 2534510f0bfd2246886f93745e68fe0b7d351e5a Mon Sep 17 00:00:00 2001 From: WofWca Date: Wed, 17 Sep 2025 10:13:30 +0400 Subject: [PATCH] docs: add docs for JS `BaseDeltaChat` Regarding the `@deprecated` addition: it's not clear to me why the `listAccounts` function exists, why `getAllAccounts` gets special treatment. It has been there ever since the introduction of JSON-RPC. Maybe it's because of the existence of `getContextEvents`, which has to do with accounts. But hopefully the new doc on `getContextEvents` compensates for this. --- deltachat-jsonrpc/typescript/src/client.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/deltachat-jsonrpc/typescript/src/client.ts b/deltachat-jsonrpc/typescript/src/client.ts index 9d7083deb..dd0c6e32b 100644 --- a/deltachat-jsonrpc/typescript/src/client.ts +++ b/deltachat-jsonrpc/typescript/src/client.ts @@ -35,6 +35,10 @@ export class BaseDeltaChat< constructor( public transport: Transport, + /** + * Whether to start calling {@linkcode RawClient.getNextEvent} + * and emitting the respective events on this class. + */ startEventLoop: boolean, ) { super(); @@ -44,6 +48,9 @@ export class BaseDeltaChat< } } + /** + * @see the constructor's `startEventLoop` + */ async eventLoop(): Promise { while (true) { const event = await this.rpc.getNextEvent(); @@ -62,10 +69,17 @@ export class BaseDeltaChat< } } + /** + * @deprecated use {@linkcode BaseDeltaChat.rpc.getAllAccounts} instead. + */ async listAccounts(): Promise { return await this.rpc.getAllAccounts(); } + /** + * A convenience function to listen on events binned by `account_id` + * (see {@linkcode RawClient.getAllAccounts}). + */ getContextEvents(account_id: number) { if (this.contextEmitters[account_id]) { return this.contextEmitters[account_id];