Skip to content

Commit

Permalink
Chain on init Promise to resolve
Browse files Browse the repository at this point in the history
  • Loading branch information
jnowakow committed Dec 17, 2024
1 parent ceebb96 commit ee98fe0
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/libs/Pusher/pusher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ function callSocketEventCallbacks(eventName: SocketEventName, data?: EventCallba
function init(args: Args, params?: unknown): Promise<void> {
return new Promise<void>((resolve) => {
if (socket) {
resolveInitPromise();
resolve();
return;
}
Expand Down Expand Up @@ -135,7 +134,6 @@ function init(args: Args, params?: unknown): Promise<void> {
socket?.connection.bind('connected', () => {
pusherSocketID = socket?.connection.socket_id ?? '';

Check failure on line 135 in src/libs/Pusher/pusher.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

callSocketEventCallbacks('connected');
resolveInitPromise();
resolve();
});

Expand All @@ -146,7 +144,7 @@ function init(args: Args, params?: unknown): Promise<void> {
socket?.connection.bind('state_change', (states: States) => {
callSocketEventCallbacks('state_change', states);
});
});
}).then(resolveInitPromise);
}

/**
Expand Down

0 comments on commit ee98fe0

Please sign in to comment.