Use single WebAPI instance across the app

This commit is contained in:
Fedor Indutny 2021-07-23 10:23:50 -07:00 committed by GitHub
parent 79633a9e7b
commit fdec47d637
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 218 additions and 308 deletions

View file

@ -439,14 +439,11 @@ class Message {
}
export default class MessageSender {
server: WebAPIType;
pendingMessages: {
[id: string]: PQueue;
};
constructor(username: string, password: string) {
this.server = window.WebAPI.connect({ username, password });
constructor(public readonly server: WebAPIType) {
this.pendingMessages = {};
}