mirror of
https://github.com/vector-im/element-call.git
synced 2026-03-04 05:37:22 +00:00
Enable lint rules for Promise handling to discourage misuse of them. (#2607)
* Enable lint rules for Promise handling to discourage misuse of them. Squashed all of Hugh's commits into one. --------- Co-authored-by: Hugh Nimmo-Smith <hughns@element.io>
This commit is contained in:
@@ -158,17 +158,15 @@ export const widget = ((): WidgetHelpers | null => {
|
||||
false,
|
||||
);
|
||||
|
||||
const clientPromise = new Promise<MatrixClient>((resolve) => {
|
||||
(async (): Promise<void> => {
|
||||
// Wait for the config file to be ready (we load very early on so it might not
|
||||
// be otherwise)
|
||||
await Config.init();
|
||||
await client.startClient({ clientWellKnownPollPeriod: 60 * 10 });
|
||||
resolve(client);
|
||||
})();
|
||||
});
|
||||
const clientPromise = async (): Promise<MatrixClient> => {
|
||||
// Wait for the config file to be ready (we load very early on so it might not
|
||||
// be otherwise)
|
||||
await Config.init();
|
||||
await client.startClient({ clientWellKnownPollPeriod: 60 * 10 });
|
||||
return client;
|
||||
};
|
||||
|
||||
return { api, lazyActions, client: clientPromise };
|
||||
return { api, lazyActions, client: clientPromise() };
|
||||
} else {
|
||||
if (import.meta.env.MODE !== "test")
|
||||
logger.info("No widget API available");
|
||||
|
||||
Reference in New Issue
Block a user