[Refactoring] GramJs: Replace deprecated functions (#32)

This commit is contained in:
Kiko Beats 2021-11-06 00:06:48 +01:00 committed by GitHub
parent 71d56e2f51
commit f8c369bef1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -128,16 +128,13 @@ class PromisedWebSockets {
receive() {
this.client.onmessage = async (message) => {
const release = await mutex.acquire();
try {
await mutex.runExclusive(async () => {
const data = message.data instanceof ArrayBuffer
? Buffer.from(message.data)
: Buffer.from(await new Response(message.data).arrayBuffer());
this.stream = Buffer.concat([this.stream, data]);
this.resolveRead(true);
} finally {
release();
}
});
};
}
}