Skip to content

Commit

Permalink
Add wek worker support
Browse files Browse the repository at this point in the history
  • Loading branch information
humbertogontijo committed Oct 28, 2024
1 parent 3d77d52 commit 685dab3
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gramjs/client/telegramBaseClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ const clientParamsDefault = {
langCode: "en",
systemLangCode: "en",
_securityChecks: true,
useWSS: isBrowser ? window.location.protocol == "https:" : false,
useWSS: isBrowser,
testServers: false,
};

Expand Down
2 changes: 1 addition & 1 deletion gramjs/extensions/PromisedWebSockets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export class PromisedWebSockets {
};
//CONTEST
if (isBrowser) {
window.addEventListener("offline", async () => {
self.addEventListener("offline", async () => {
await this.close();
if (this.resolveRead) {
this.resolveRead(false);
Expand Down
2 changes: 1 addition & 1 deletion gramjs/platform.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export const isDeno = "Deno" in globalThis;
export const isBrowser = !isDeno && typeof window !== "undefined";
export const isBrowser = !isDeno && typeof self !== "undefined";
export const isNode = !isBrowser;

0 comments on commit 685dab3

Please sign in to comment.