Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the message subscription return an optional unsubscribe callback #5

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

wewei
Copy link

@wewei wewei commented Mar 27, 2024

Hi, @JichouP , thanks for building this handy package to add TypeScript support for electron IPC. When I was using it, I find there's no way to unsubscribe a message from main. I propose this change to let the on.xxx function return an optional callback, so that the renderer code can unsubscribe the message channel when it's no longer needed.

I also made a small change in the build scripts, use rimraf, which is cross platform, to replace the POSIX command rm -rf. With this change, the package can be built on Windows.

Feel free to comments, and I'll make changes accordingly.

@JichouP
Copy link
Owner

JichouP commented Mar 30, 2024

@wewei
Thank you for your contribution.
It looks good to me!

Did it work correctly without changing the return type here?
https://github.com/JichouP/electron-typescript-ipc/blob/bf61ffc/src/index.ts#L19

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants