Skip to content

Commit

Permalink
fix(chrome): fix chrome ext disconnect (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
unadlib authored Jan 2, 2025
1 parent 6607495 commit 742c994
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions examples/browser-extension/src/background/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ transport.onConnect((id) => {
console.log('connect:', id);
});

transport.onDisconnect((id) => {
console.log('disconnect:', id);
});

// @ts-ignore
transport.listen('contentToBg', async (a, b) => a);

Expand Down
3 changes: 3 additions & 0 deletions src/transports/browserExtensionsTransport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,9 @@ export abstract class BrowserExtensionsMainTransport<
this.ports.delete(id);
}
});
this._onDisconnectCallback.forEach((callback) => {
callback(id);
});
});

// @ts-ignore
Expand Down

0 comments on commit 742c994

Please sign in to comment.